private static TextPaint InnerBuildPaint(FontWeight fontWeight, FontStyle fontStyle, FontFamily fontFamily, double fontSize, double characterSpacing, Windows.UI.Color foreground, BaseLineAlignment baselineAlignment, UnderlineStyle underlineStyle) { var paint = new TextPaint(PaintFlags.AntiAlias); var paintSpecs = BuildPaintValueSpecs(fontSize, characterSpacing); paint.Density = paintSpecs.density; paint.TextSize = paintSpecs.textSize; paint.UnderlineText = underlineStyle == UnderlineStyle.Single; if (baselineAlignment == BaseLineAlignment.Superscript) { paint.BaselineShift += (int)(paint.Ascent() / 2); } if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop) { paint.LetterSpacing = paintSpecs.letterSpacing; } else { LogCharacterSpacingNotSupported(); } var typefaceStyle = TypefaceStyleHelper.GetTypefaceStyle(fontStyle, fontWeight); var typeface = FontHelper.FontFamilyToTypeFace(fontFamily, fontWeight, typefaceStyle); paint.SetTypeface(typeface); paint.Color = foreground; return(paint); }
partial void UpdateFontPartial() { if (Parent != null && _textBoxView != null) { var style = TypefaceStyleHelper.GetTypefaceStyle(FontStyle, FontWeight); var typeface = FontHelper.FontFamilyToTypeFace(FontFamily, FontWeight); _textBoxView.SetTypeface(typeface, style); _textBoxView.SetTextSize(ComplexUnitType.Px, (float)Math.Round(ViewHelper.LogicalToPhysicalFontPixels((float)FontSize))); } }