@@ -37,6 +37,7 @@ class CkParagraphStyle implements ui.ParagraphStyle {
3737 _fontFamily = fontFamily,
3838 _fontSize = fontSize,
3939 _height = height,
40+ _leadingDistribution = textHeightBehavior? .leadingDistribution,
4041 _fontWeight = fontWeight,
4142 _fontStyle = fontStyle;
4243
@@ -47,6 +48,7 @@ class CkParagraphStyle implements ui.ParagraphStyle {
4748 final double ? _height;
4849 final ui.FontWeight ? _fontWeight;
4950 final ui.FontStyle ? _fontStyle;
51+ final ui.TextLeadingDistribution ? _leadingDistribution;
5052
5153 static SkTextStyleProperties toSkTextStyleProperties (
5254 String ? fontFamily,
@@ -73,7 +75,7 @@ class CkParagraphStyle implements ui.ParagraphStyle {
7375 return skTextStyle;
7476 }
7577
76- static SkStrutStyleProperties toSkStrutStyleProperties (ui.StrutStyle value) {
78+ static SkStrutStyleProperties toSkStrutStyleProperties (ui.StrutStyle value, ui. TextHeightBehavior ? paragraphHeightBehavior ) {
7779 EngineStrutStyle style = value as EngineStrutStyle ;
7880 final SkStrutStyleProperties skStrutStyle = SkStrutStyleProperties ();
7981 skStrutStyle.fontFamilies =
@@ -87,6 +89,17 @@ class CkParagraphStyle implements ui.ParagraphStyle {
8789 skStrutStyle.heightMultiplier = style._height;
8890 }
8991
92+ switch (style._leadingDistribution ?? paragraphHeightBehavior? .leadingDistribution) {
93+ case null :
94+ break ;
95+ case ui.TextLeadingDistribution .even:
96+ skStrutStyle.halfLeading = true ;
97+ break ;
98+ case ui.TextLeadingDistribution .proportional:
99+ skStrutStyle.halfLeading = false ;
100+ break ;
101+ }
102+
90103 if (style._leading != null ) {
91104 skStrutStyle.leading = style._leading;
92105 }
@@ -147,7 +160,7 @@ class CkParagraphStyle implements ui.ParagraphStyle {
147160 }
148161
149162 if (strutStyle != null ) {
150- properties.strutStyle = toSkStrutStyleProperties (strutStyle);
163+ properties.strutStyle = toSkStrutStyleProperties (strutStyle, textHeightBehavior );
151164 }
152165
153166 properties.textStyle = toSkTextStyleProperties (
@@ -161,6 +174,7 @@ class CkParagraphStyle implements ui.ParagraphStyle {
161174 fontFamily: _fontFamily,
162175 fontSize: _fontSize,
163176 height: _height,
177+ leadingDistribution: _leadingDistribution,
164178 fontWeight: _fontWeight,
165179 fontStyle: _fontStyle,
166180 );
@@ -184,6 +198,7 @@ class CkTextStyle implements ui.TextStyle {
184198 double ? letterSpacing,
185199 double ? wordSpacing,
186200 double ? height,
201+ ui.TextLeadingDistribution ? leadingDistribution,
187202 ui.Locale ? locale,
188203 CkPaint ? background,
189204 CkPaint ? foreground,
@@ -205,6 +220,7 @@ class CkTextStyle implements ui.TextStyle {
205220 letterSpacing,
206221 wordSpacing,
207222 height,
223+ leadingDistribution,
208224 locale,
209225 background,
210226 foreground,
@@ -228,6 +244,7 @@ class CkTextStyle implements ui.TextStyle {
228244 this .letterSpacing,
229245 this .wordSpacing,
230246 this .height,
247+ this .leadingDistribution,
231248 this .locale,
232249 this .background,
233250 this .foreground,
@@ -249,6 +266,7 @@ class CkTextStyle implements ui.TextStyle {
249266 final double ? letterSpacing;
250267 final double ? wordSpacing;
251268 final double ? height;
269+ final ui.TextLeadingDistribution ? leadingDistribution;
252270 final ui.Locale ? locale;
253271 final CkPaint ? background;
254272 final CkPaint ? foreground;
@@ -275,6 +293,7 @@ class CkTextStyle implements ui.TextStyle {
275293 letterSpacing: other.letterSpacing ?? letterSpacing,
276294 wordSpacing: other.wordSpacing ?? wordSpacing,
277295 height: other.height ?? height,
296+ leadingDistribution: other.leadingDistribution ?? leadingDistribution,
278297 locale: other.locale ?? locale,
279298 background: other.background ?? background,
280299 foreground: other.foreground ?? foreground,
@@ -367,6 +386,17 @@ class CkTextStyle implements ui.TextStyle {
367386 properties.heightMultiplier = height;
368387 }
369388
389+ switch (leadingDistribution) {
390+ case null :
391+ break ;
392+ case ui.TextLeadingDistribution .even:
393+ properties.halfLeading = true ;
394+ break ;
395+ case ui.TextLeadingDistribution .proportional:
396+ properties.halfLeading = false ;
397+ break ;
398+ }
399+
370400 if (locale != null ) {
371401 properties.locale = locale.toLanguageTag ();
372402 }
0 commit comments