Skip to content

Commit

Permalink
fix fontfallback for font with some styles like bold/italic etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
donandren committed Dec 20, 2019
1 parent dd864dd commit c64cc71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Skia/Avalonia.Skia/FontManagerImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ public IGlyphTypefaceImpl CreateGlyphTypeface(Typeface typeface)

if (typeface.FontFamily.Key == null)
{
var defaultName = SKTypeface.Default.FamilyName;

foreach (var familyName in typeface.FontFamily.FamilyNames)
{
skTypeface = SKTypeface.FromFamilyName(familyName, (SKFontStyleWeight)typeface.Weight,
SKFontStyleWidth.Normal, (SKFontStyleSlant)typeface.Style);

if (skTypeface == SKTypeface.Default)
if (!skTypeface.FamilyName.Equals(familyName, StringComparison.Ordinal) &&
defaultName.Equals(skTypeface.FamilyName, StringComparison.Ordinal))
{
continue;
}
Expand Down

0 comments on commit c64cc71

Please sign in to comment.