Skip to content

Commit

Permalink
Merge pull request #643 from FastReports/sync_branch_2023.3.12
Browse files Browse the repository at this point in the history
FastReport.OpenSource 2023.3.12
  • Loading branch information
0legK authored Nov 15, 2023
2 parents 12ad96c + d6bed25 commit 7c1a078
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions FastReport.Base/Utils/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,37 @@ public static object FromString(Type type, string value)
}
if (type == typeof(Font))
{
Font font = new TypeConverters.FontConverter().ConvertFromInvariantString(value) as Font;
return Config.PrivateFontCollection.CheckFamily(font);
Font font;

#if FRCORE || COREWIN
// This patch made for "Wix Madefor Text" font
// We manually parse font description and create font

String[] fontNameFields = value.Split(',');
if (Config.PrivateFontCollection.HasFont(fontNameFields[0]))
{
FontFamily fontFamily = new FontFamily(fontNameFields[0], Config.PrivateFontCollection.Collection);
fontNameFields[1] = fontNameFields[1].Replace("pt", "");
float size = float.Parse(fontNameFields[1]);
if(fontNameFields.Length == 3)
{
fontNameFields[2] = fontNameFields[2].Replace("style=", "");
FontStyle style = ((FontStyle)Enum.Parse(typeof(FontStyle), fontNameFields[2]));
font = new Font(fontFamily, size, style);
}
else
{
font = new Font(fontFamily, size);
}
}
else
#endif
{
font = new TypeConverters.FontConverter().ConvertFromInvariantString(value) as Font;
font = Config.PrivateFontCollection.CheckFamily(font);
}

return font;
}

if (type == typeof(Color))
Expand Down

0 comments on commit 7c1a078

Please sign in to comment.