Exemplo n.º 1
0
        public static FormattedTextImpl Create(string text, string fontFamilyName, double fontSize, FontStyle fontStyle,
                                               TextAlignment textAlignment, FontWeight fontWeight)
        {
            var typeface = TypefaceCache.GetTypeface(fontFamilyName, fontStyle, fontWeight);

            FormattedTextImpl instance = new FormattedTextImpl(text);

            instance.Paint.Typeface  = typeface;
            instance.Paint.TextSize  = (float)fontSize;
            instance.Paint.TextAlign = textAlignment.ToSKTextAlign();
            instance.Rebuild();
            return(instance);
        }
Exemplo n.º 2
0
        public static FormattedTextImpl Create(string text, string fontFamilyName, double fontSize, FontStyle fontStyle,
                                               TextAlignment textAlignment, FontWeight fontWeight)
        {
            NativeFormattedText *pShared;

            fixed(void *ptext = text)
            {
                IntPtr handle = MethodTable.Instance.CreateFormattedText(ptext, text.Length,
                                                                         TypefaceCache.GetTypeface(fontFamilyName, fontStyle, fontWeight),
                                                                         (float)fontSize, textAlignment, &pShared);

                return(new FormattedTextImpl(handle, pShared, text));
            }
        }