Example #1
0
 static SKFontStyle()
 {
     normal     = new SKFontStyleStatic(SKFontStyleWeight.Normal, SKFontStyleWidth.Normal, SKFontStyleSlant.Upright);
     bold       = new SKFontStyleStatic(SKFontStyleWeight.Bold, SKFontStyleWidth.Normal, SKFontStyleSlant.Upright);
     italic     = new SKFontStyleStatic(SKFontStyleWeight.Normal, SKFontStyleWidth.Normal, SKFontStyleSlant.Italic);
     boldItalic = new SKFontStyleStatic(SKFontStyleWeight.Bold, SKFontStyleWidth.Normal, SKFontStyleSlant.Italic);
 }
Example #2
0
 public void GetStyle(int index, out SKFontStyle fontStyle, out string styleName)
 {
     fontStyle = new SKFontStyle();
     using (var str = new SKString()) {
         SkiaApi.sk_fontstyleset_get_style(Handle, index, fontStyle.Handle, str.Handle);
         styleName = (string)str;
     }
 }
Example #3
0
        public SKTypeface MatchFamily(string familyName, SKFontStyle style)
        {
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            return(GetObject <SKTypeface> (SkiaApi.sk_fontmgr_match_family_style(Handle, familyName, style.Handle)));
        }
Example #4
0
        public static SKTypeface FromFamilyName(string familyName, SKFontStyle style)
        {
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            return(GetObject <SKTypeface> (SkiaApi.sk_typeface_create_from_name_with_font_style(familyName, style.Handle)));
        }
Example #5
0
        public SKTypeface CreateTypeface(SKFontStyle style)
        {
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            return(GetObject <SKTypeface> (SkiaApi.sk_fontstyleset_match_style(Handle, style.Handle)));
        }
Example #6
0
        public SKTypeface MatchFamily(string familyName, SKFontStyle style)
        {
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            var tf = SKTypeface.GetObject(SkiaApi.sk_fontmgr_match_family_style(Handle, familyName, style.Handle));

            tf?.PreventPublicDisposal();
            return(tf);
        }
Example #7
0
        public static SKTypeface FromFamilyName(string familyName, SKFontStyle style)
        {
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            var tf = GetObject(SkiaApi.sk_typeface_create_from_name(familyName, style.Handle));

            tf?.PreventPublicDisposal();
            return(tf);
        }
Example #8
0
        public SKTypeface MatchCharacter(string familyName, SKFontStyle style, string[] bcp47, int character)
        {
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            // TODO: work around for https://bugs.chromium.org/p/skia/issues/detail?id=6196
            if (familyName == null)
            {
                familyName = string.Empty;
            }

            return(GetObject <SKTypeface> (SkiaApi.sk_fontmgr_match_family_style_character(Handle, familyName, style.Handle, bcp47, bcp47?.Length ?? 0, character)));
        }