flutter_html_css_text_metrics 0.3.0
flutter_html_css_text_metrics: ^0.3.0 copied to clipboard
A flutter_html extension that applies letter-spacing, word-spacing, text-decoration-thickness and the font-family fallback list from an element's inline style.
0.3.0 #
- Renamed from
flutter_html_css_text_metrics_extensionon pub.flutter-io.cn. The old package stays published and is marked discontinued with this one as its replacement. Class names are unchanged.
0.2.0 #
text-decoration-thicknessnow takes a length and a percentage, as a documented approximation. Flutter'sdecorationThicknessis a multiplier of the line the font itself draws, and Flutter exposes no way to read that line, so the length is divided by one twelfth of the element'sfont-size. Measured on a red underline atfont-size: 40px: the painted line was 1.00 px for10px,0.25emand50%in 0.1.0, because all three were ignored, and it is 2.50 px, 2.50 px and 4.75 px now. The multipliers behind those numbers are 3.0, 3.0 and 6.0. The same10pxon a 12 px font asks for 10.0, because the divisor is the element's own font size.auto,from-fontand the unitless multiple behave exactly as they did. So does a value the extension cannot resolve:pt,cm,vw, a negative length and nonsense all leave the element alone, with no error and no warning. Measured:30ptpaints the same pixels with and without the extension.parseCssTextDecorationThicknesstakes two new optional named arguments,emBaseandremBase. Without them it returns what 0.1.0 returned,null, for every length and every percentage.kAssumedDecorationThicknessDivisoris the 12 in the arithmetic, and is exported.- Documents a limitation the same measurement found, which this extension does not cause
and cannot fix: a child that declares its own
text-decorationerases the ancestor's line over the child's text, and its own line is painted in the ancestor's colour. Measured atfont-size: 40pxwith a parentunderline redand a childoverline blue: 320 red pixels, against 560 with no declaration on the child.
0.1.0 #
- Initial release. Applies
letter-spacing,word-spacingandtext-decoration-thicknessfrom an element's inline style, and keeps the wholefont-familylist instead of only its first entry, so the eight-family fallback stack behind Bootstrap's.font-monospacereaches Flutter instead of just its first name. Lengths resolve inpx,emandrem;normalhands the spacing back to the font rather than setting it to zero. - If you register
flutter_html_css_font_sizeas well, list it before this one: both match at thepreProcessingstep and they run in registration order, so it has to resolve theemfont size before anemletter-spacingcan scale against it (4.2 rather than 2.1 on a nestedem).