void UpdateFont()
        {
#pragma warning disable 618 // We will need to update this when .Font goes away
            Font f = Element.Font;
#pragma warning restore 618

            Typeface newTypeface = f.ToTypeface();
            if (newTypeface != _lastTypeface)
            {
                _view.Typeface = newTypeface;
                _lastTypeface  = newTypeface;
            }

            float newTextSize = f.ToScaledPixel();
            if (newTextSize != _lastTextSize)
            {
                _view.SetTextSize(ComplexUnitType.Sp, newTextSize);
                _lastTextSize = newTextSize;
            }
        }
示例#2
0
        void UpdateFont()
        {
            Font f = Font.OfSize(Element.FontFamily, Element.FontSize).WithAttributes(Element.FontAttributes);

            Typeface newTypeface = f.ToTypeface();

            if (newTypeface != _lastTypeface)
            {
                _view.Typeface = newTypeface;
                _lastTypeface  = newTypeface;
            }

            float newTextSize = f.ToScaledPixel();

            if (newTextSize != _lastTextSize)
            {
                _view.SetTextSize(ComplexUnitType.Sp, newTextSize);
                _lastTextSize = newTextSize;
            }
        }