Skip to content

Commit d6bed25

Browse files
* sync 11/15/2023 version: 2023.3.12
1 parent 12ad96c commit d6bed25

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

FastReport.Base/Utils/Converter.cs

+31-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,37 @@ public static object FromString(Type type, string value)
134134
}
135135
if (type == typeof(Font))
136136
{
137-
Font font = new TypeConverters.FontConverter().ConvertFromInvariantString(value) as Font;
138-
return Config.PrivateFontCollection.CheckFamily(font);
137+
Font font;
138+
139+
#if FRCORE || COREWIN
140+
// This patch made for "Wix Madefor Text" font
141+
// We manually parse font description and create font
142+
143+
String[] fontNameFields = value.Split(',');
144+
if (Config.PrivateFontCollection.HasFont(fontNameFields[0]))
145+
{
146+
FontFamily fontFamily = new FontFamily(fontNameFields[0], Config.PrivateFontCollection.Collection);
147+
fontNameFields[1] = fontNameFields[1].Replace("pt", "");
148+
float size = float.Parse(fontNameFields[1]);
149+
if(fontNameFields.Length == 3)
150+
{
151+
fontNameFields[2] = fontNameFields[2].Replace("style=", "");
152+
FontStyle style = ((FontStyle)Enum.Parse(typeof(FontStyle), fontNameFields[2]));
153+
font = new Font(fontFamily, size, style);
154+
}
155+
else
156+
{
157+
font = new Font(fontFamily, size);
158+
}
159+
}
160+
else
161+
#endif
162+
{
163+
font = new TypeConverters.FontConverter().ConvertFromInvariantString(value) as Font;
164+
font = Config.PrivateFontCollection.CheckFamily(font);
165+
}
166+
167+
return font;
139168
}
140169

141170
if (type == typeof(Color))

0 commit comments

Comments
 (0)