|
|
@ -1,4 +1,5 @@ |
|
|
using System; |
|
|
using System; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Reflection; |
|
|
using System.Reflection; |
|
|
using Avalonia.Media; |
|
|
using Avalonia.Media; |
|
|
using Avalonia.Platform; |
|
|
using Avalonia.Platform; |
|
|
@ -29,6 +30,23 @@ namespace Avalonia.Skia.UnitTests |
|
|
Assert.Equal(SKTypeface.Default.FontSlant, skTypeface.FontSlant); |
|
|
Assert.Equal(SKTypeface.Default.FontSlant, skTypeface.FontSlant); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void Should_Create_Typeface_From_Fallback_Bold() |
|
|
|
|
|
{ |
|
|
|
|
|
var fontManager = new FontManagerImpl(); |
|
|
|
|
|
|
|
|
|
|
|
//we need to have a valid font name different from the default one
|
|
|
|
|
|
string fontName = fontManager.GetInstalledFontFamilyNames().First(); |
|
|
|
|
|
|
|
|
|
|
|
var glyphTypeface = (GlyphTypefaceImpl)fontManager.CreateGlyphTypeface( |
|
|
|
|
|
new Typeface(new FontFamily($"A, B, {fontName}"), FontWeight.Bold)); |
|
|
|
|
|
|
|
|
|
|
|
var skTypeface = glyphTypeface.Typeface; |
|
|
|
|
|
|
|
|
|
|
|
Assert.Equal(fontName, skTypeface.FamilyName); |
|
|
|
|
|
Assert.Equal(SKFontStyle.Bold.Weight, skTypeface.FontWeight); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public void Should_Create_Typeface_For_Unknown_Font() |
|
|
public void Should_Create_Typeface_For_Unknown_Font() |
|
|
{ |
|
|
{ |
|
|
|