@@ -68,12 +68,23 @@ public XGlyphTypeface(string key, XFontSource fontSource)
6868 Initialize ( ) ;
6969 }
7070
71+ // ReSharper disable once UnusedMember.Global
72+ public XGlyphTypeface ( string key , XFontFamily fontFamily , XFontSource fontSource , XStyleSimulations styleSimulations )
73+ {
74+ _key = key ;
75+ _fontFamily = fontFamily ;
76+ _fontSource = fontSource ;
77+ _styleSimulations = styleSimulations ;
78+ _fontface = OpenTypeFontface . CetOrCreateFrom ( fontSource ) ;
79+
80+ Initialize ( ) ;
81+ }
82+
7183 public static XGlyphTypeface GetOrCreateFrom ( string familyName , FontResolvingOptions fontResolvingOptions )
7284 {
7385 // Check cache for requested type face.
7486 string typefaceKey = ComputeKey ( familyName , fontResolvingOptions ) ;
75- XGlyphTypeface glyphTypeface ;
76- if ( GlyphTypefaceCache . TryGetGlyphTypeface ( typefaceKey , out glyphTypeface ) )
87+ if ( GlyphTypefaceCache . TryGetGlyphTypeface ( typefaceKey , out var glyphTypeface ) )
7788 {
7889 // Just return existing one.
7990 return glyphTypeface ;
@@ -88,8 +99,7 @@ public static XGlyphTypeface GetOrCreateFrom(string familyName, FontResolvingOpt
8899 }
89100 // Now create the font family at the first.
90101 XFontFamily fontFamily ;
91- PlatformFontResolverInfo platformFontResolverInfo = fontResolverInfo as PlatformFontResolverInfo ;
92- if ( platformFontResolverInfo != null )
102+ if ( fontResolverInfo is PlatformFontResolverInfo platformFontResolverInfo )
93103 {
94104 }
95105 else
0 commit comments