flutter_html_css_text_metrics 0.3.0 copy "flutter_html_css_text_metrics: ^0.3.0" to clipboard
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_extension on 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-thickness now takes a length and a percentage, as a documented approximation. Flutter's decorationThickness is 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's font-size. Measured on a red underline at font-size: 40px: the painted line was 1.00 px for 10px, 0.25em and 50% 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 same 10px on a 12 px font asks for 10.0, because the divisor is the element's own font size.
  • auto, from-font and 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: 30pt paints the same pixels with and without the extension.
  • parseCssTextDecorationThickness takes two new optional named arguments, emBase and remBase. Without them it returns what 0.1.0 returned, null, for every length and every percentage. kAssumedDecorationThicknessDivisor is 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-decoration erases the ancestor's line over the child's text, and its own line is painted in the ancestor's colour. Measured at font-size: 40px with a parent underline red and a child overline blue: 320 red pixels, against 560 with no declaration on the child.

0.1.0 #

  • Initial release. Applies letter-spacing, word-spacing and text-decoration-thickness from an element's inline style, and keeps the whole font-family list instead of only its first entry, so the eight-family fallback stack behind Bootstrap's .font-monospace reaches Flutter instead of just its first name. Lengths resolve in px, em and rem; normal hands the spacing back to the font rather than setting it to zero.
  • If you register flutter_html_css_font_size as well, list it before this one: both match at the preProcessing step and they run in registration order, so it has to resolve the em font size before an em letter-spacing can scale against it (4.2 rather than 2.1 on a nested em).
0
likes
160
points
53
downloads

Documentation

API reference

Publisher

verified publisherchaosworld.cc

Weekly Downloads

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.

Repository (GitLab)
View/report issues
Contributing

Topics

#flutter-html #css #html #extension #letter-spacing

License

MPL-2.0 (license)

Dependencies

flutter, flutter_html, html

More

Packages that depend on flutter_html_css_text_metrics