@@ -20,9 +20,6 @@ namespace Uno.UI.Controls
20
20
/// </summary>
21
21
internal class TextPaintPool
22
22
{
23
- private static readonly Action LogCharacterSpacingNotSupported =
24
- Actions . CreateOnce ( ( ) => typeof ( TextPaintPool ) . Log ( ) . Warn ( "CharacterSpacing is only supported on Android API Level 21+" ) ) ;
25
-
26
23
private record Entry (
27
24
FontWeight FontWeight ,
28
25
FontStyle FontStyle ,
@@ -128,39 +125,21 @@ private static void TryScavenge()
128
125
129
126
private static TextPaint InnerBuildPaint ( FontWeight fontWeight , FontStyle fontStyle , FontFamily fontFamily , double fontSize , double characterSpacing , Color foreground , Shader shader , BaseLineAlignment baselineAlignment , TextDecorations textDecorations )
130
127
{
131
- var paint = new TextPaint ( PaintFlags . AntiAlias ) ;
132
-
133
128
var paintSpecs = BuildPaintValueSpecs ( fontSize , characterSpacing ) ;
134
129
135
- paint . Density = paintSpecs . density ;
136
- paint . TextSize = paintSpecs . textSize ;
137
- paint . UnderlineText = ( textDecorations & TextDecorations . Underline ) == TextDecorations . Underline ;
138
- paint . StrikeThruText = ( textDecorations & TextDecorations . Strikethrough ) == TextDecorations . Strikethrough ;
139
- if ( shader != null )
140
- {
141
- paint . SetShader ( shader ) ;
142
- }
143
-
144
- if ( baselineAlignment == BaseLineAlignment . Superscript )
145
- {
146
- paint . BaselineShift += ( int ) ( paint . Ascent ( ) / 2 ) ;
147
- }
148
-
149
- if ( Android . OS . Build . VERSION . SdkInt >= Android . OS . BuildVersionCodes . Lollipop )
150
- {
151
- paint . LetterSpacing = paintSpecs . letterSpacing ;
152
- }
153
- else
154
- {
155
- LogCharacterSpacingNotSupported ( ) ;
156
- }
157
-
158
130
var typefaceStyle = TypefaceStyleHelper . GetTypefaceStyle ( fontStyle , fontWeight ) ;
159
- var typeface = FontHelper . FontFamilyToTypeFace ( fontFamily , fontWeight , typefaceStyle ) ;
160
- paint . SetTypeface ( typeface ) ;
161
- paint . Color = foreground ;
162
131
163
- return paint ;
132
+ return TextPaintPoolNative . BuildPaint (
133
+ paintSpecs . density ,
134
+ paintSpecs . textSize ,
135
+ paintSpecs . letterSpacing ,
136
+ FontHelper . FontFamilyToTypeFace ( fontFamily , fontWeight , typefaceStyle ) ,
137
+ ( int ) ( ( Android . Graphics . Color ) foreground ) ,
138
+ ( textDecorations & TextDecorations . Underline ) == TextDecorations . Underline ,
139
+ ( textDecorations & TextDecorations . Strikethrough ) == TextDecorations . Strikethrough ,
140
+ baselineAlignment == BaseLineAlignment . Superscript ,
141
+ shader
142
+ ) ;
164
143
}
165
144
166
145
internal static ( float density , float textSize , float letterSpacing ) BuildPaintValueSpecs ( double fontSize , double characterSpacing )
0 commit comments