Example #1
0
        public static void SetFontSettings(this IStyleHelper helper, TextView view, float parentHeight)
        {
            string fontFamily;

            if (helper.TryGetFontFamily(out fontFamily))
            {
                view.SetTypeface(Typeface.Create(fontFamily, TypefaceStyle.Normal), TypefaceStyle.Normal);
            }

            float fontSize;

            if (helper.TryGetFontSize(parentHeight, out fontSize))
            {
                view.SetTextSize(ComplexUnitType.Px, fontSize);
            }
        }
        public static bool FontChanged(this IStyleHelper helper, float parentHeight, out UIFont font)
        {
            string fontFamily;
            float  fontSize;
            bool   changed = helper.TryGetFontFamily(out fontFamily);

            changed |= helper.TryGetFontSize(parentHeight, out fontSize);

            if (changed)
            {
                font = UIFont.FromName(fontFamily, fontSize);
                return(true);
            }

            font = null;
            return(false);
        }