@@ -118,18 +118,18 @@ constexpr uint32_t kFontFeatureTagLength = 4;
118118const int sFontWeightIndex = 0 ;
119119const int sFontStyleIndex = 1 ;
120120const int sFontFamilyIndex = 2 ;
121- const int sFontSizeIndex = 3 ;
122- const int sHeightIndex = 4 ;
123- const int sLeadingDistributionIndex = 5 ;
121+ const int sLeadingDistributionIndex = 3 ;
122+ const int sFontSizeIndex = 4 ;
123+ const int sHeightIndex = 5 ;
124124const int sLeadingIndex = 6 ;
125125const int sForceStrutHeightIndex = 7 ;
126126
127127const int sFontWeightMask = 1 << sFontWeightIndex ;
128128const int sFontStyleMask = 1 << sFontStyleIndex ;
129129const int sFontFamilyMask = 1 << sFontFamilyIndex ;
130+ const int sLeadingDistributionMask = 1 << sLeadingDistributionIndex ;
130131const int sFontSizeMask = 1 << sFontSizeIndex ;
131132const int sHeightMask = 1 << sHeightIndex ;
132- const int sLeadingDistributionMask = 1 << sLeadingDistributionIndex ;
133133const int sLeadingMask = 1 << sLeadingIndex ;
134134const int sForceStrutHeightMask = 1 << sForceStrutHeightIndex ;
135135
@@ -201,6 +201,10 @@ void decodeStrut(Dart_Handle strut_data,
201201 paragraph_style.strut_font_style =
202202 static_cast <txt::FontStyle>(uint8_data[byte_count++]);
203203 }
204+ if (mask & sLeadingDistributionMask ) {
205+ paragraph_style.strut_has_leading_distribution_override = true ;
206+ paragraph_style.strut_half_leading = uint8_data[byte_count++];
207+ }
204208
205209 std::vector<float > float_data;
206210 float_data.resize ((byte_data.length_in_bytes () - byte_count) / 4 );
@@ -214,20 +218,13 @@ void decodeStrut(Dart_Handle strut_data,
214218 if (mask & sHeightMask ) {
215219 paragraph_style.strut_height = float_data[float_count++];
216220 paragraph_style.strut_has_height_override = true ;
217-
218- // LeadingDistribution does not affect layout if height is not set.
219- if (mask & sLeadingDistributionMask ) {
220- paragraph_style.strut_half_leading = uint8_data[byte_count];
221- paragraph_style.strut_has_leading_distribution_override = true ;
222- }
223221 }
224222 if (mask & sLeadingMask ) {
225223 paragraph_style.strut_leading = float_data[float_count++];
226224 }
227- if (mask & sForceStrutHeightMask ) {
228- // The boolean is stored as the last bit in the bitmask.
229- paragraph_style.force_strut_height = (mask & 1 << 7 ) != 0 ;
230- }
225+
226+ // The boolean is stored as the last bit in the bitmask.
227+ paragraph_style.force_strut_height = mask & sForceStrutHeightMask ;
231228
232229 if (mask & sFontFamilyMask ) {
233230 paragraph_style.strut_font_families = strut_font_families;
0 commit comments