public float GetEmHeight(FontStyle style) { using (var paint = new SKPaint()) { paint.Typeface = SKTypeface.FromTypeface(_typeface, style.ToSKTypefaceStyle()); return(paint.FontMetrics.Top); } }
//Note: BB Added public Font(FontFamily fontFamily, float size, FontStyle fontStyle, GraphicsUnit graphicsUnit) { _fontFamily = fontFamily; _paint = new SKPaint(); _paint.TextSize = size; _style = fontStyle; _paint.Typeface = SKTypeface.FromTypeface(_fontFamily.Typeface, fontStyle.ToSKTypefaceStyle()); //TODO: What to use graphics Unit for? }
public unsafe void FromTypefaceReturnsSameObject() { VerifySupportsMatchingTypefaces(); var tf = SKTypeface.FromFamilyName(DefaultFontFamily); var tf1 = SKTypeface.FromTypeface(tf, SKTypefaceStyle.Normal); var tf2 = SKTypeface.FromTypeface(tf, SKTypefaceStyle.Normal); Assert.Same(tf, tf1); Assert.Same(tf1, tf2); }
public Font CreateFontVariance([NotNull] Font baseFont, FontStyle style) { var f = SKTypeface.FromTypeface(baseFont.Typeface, (SKTypefaceStyle)style); var font = new Font(this, f); font.Size = baseFont.Size; font.FakeBold = baseFont.FakeBold; _loadedFonts.Add(font); return(font); }