Skip to content

Commit c2f3c8e

Browse files
author
ArthurHub
committed
* fix default font to fallback to Sagoe UI
* add WPF glyph typeface fallback
1 parent d2fc962 commit c2f3c8e

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

Source/HtmlRenderer.WPF/Adapters/FontAdapter.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,17 @@ public FontAdapter(Typeface font, double size)
6767

6868
GlyphTypeface typeface;
6969
if (font.TryGetGlyphTypeface(out typeface))
70+
{
7071
_glyphTypeface = typeface;
72+
}
73+
else
74+
{
75+
foreach (var sysTypeface in Fonts.SystemTypefaces)
76+
{
77+
if (sysTypeface.TryGetGlyphTypeface(out typeface))
78+
break;
79+
}
80+
}
7181
}
7282

7383
/// <summary>

Source/HtmlRenderer/Core/Dom/CssBoxProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ internal abstract class CssBoxProperties
6161
private string _emptyCells = "show";
6262
private string _direction = "ltr";
6363
private string _display = "inline";
64-
private string _fontFamily = "serif";
64+
private string _fontFamily;
6565
private string _fontSize = "medium";
6666
private string _fontStyle = "normal";
6767
private string _fontVariant = "normal";

Source/HtmlRenderer/Core/Utils/CssConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,6 @@ internal static class CssConstants
162162
/// <summary>
163163
/// Default font used for the generic 'serif' family
164164
/// </summary>
165-
public const string DefaultFont = "Times New Roman";
165+
public const string DefaultFont = "Segoe UI";
166166
}
167167
}

0 commit comments

Comments
 (0)