예제 #1
0
 public float GetEmHeight(FontStyle style)
 {
     using (var paint = new SKPaint())
     {
         paint.Typeface = SKTypeface.FromTypeface(_typeface, style.ToSKTypefaceStyle());
         return(paint.FontMetrics.Top);
     }
 }
예제 #2
0
        //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?
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }