Beispiel #1
0
        Native.FormattedString ConvertFormattedText(FormattedString formattedString)
        {
            if (formattedString == null)
            {
                return(null);
            }

            Native.FormattedString nativeString = new Native.FormattedString();

            foreach (var span in formattedString.Spans)
            {
                var textDecorations = span.TextDecorations;

                Native.Span nativeSpan = new Native.Span();
                nativeSpan.Text            = span.Text;
                nativeSpan.FontAttributes  = span.FontAttributes;
                nativeSpan.FontFamily      = span.FontFamily;
                nativeSpan.FontSize        = span.FontSize;
                nativeSpan.ForegroundColor = span.TextColor.ToNative();
                nativeSpan.BackgroundColor = span.BackgroundColor.ToNative();
                nativeSpan.Underline       = (textDecorations & TextDecorations.Underline) != 0;
                nativeSpan.Strikethrough   = (textDecorations & TextDecorations.Strikethrough) != 0;
                nativeSpan.LineHeight      = span.LineHeight;
                nativeString.Spans.Add(nativeSpan);
            }

            return(nativeString);
        }
Beispiel #2
0
        Native.FormattedString ConvertFormattedText(FormattedString formattedString)
        {
            if (formattedString == null)
            {
                return(null);
            }

            Native.FormattedString nativeString = new Native.FormattedString();

            foreach (var span in formattedString.Spans)
            {
                Native.Span nativeSpan = new Native.Span();
                nativeSpan.Text            = span.Text;
                nativeSpan.FontAttributes  = span.FontAttributes;
                nativeSpan.FontFamily      = span.FontFamily;
                nativeSpan.FontSize        = span.FontSize;
                nativeSpan.ForegroundColor = span.ForegroundColor.ToNative();
                nativeSpan.BackgroundColor = span.BackgroundColor.ToNative();
                nativeString.Spans.Add(nativeSpan);
            }

            return(nativeString);
        }