woff2 0.1.0
woff2: ^0.1.0 copied to clipboard
WOFF and WOFF2 font support for Flutter — decodes WOFF1/WOFF2 to SFNT (TTF/OTF) so Flutter's FontLoader can load them. Pure-Dart decoder, high-level Flutter FontLoader wrapper, and a CSS @font-face parser.
Changelog #
0.1.0 — initial release #
First public release. The decoder and Flutter FontLoader wrapper
were extracted from
flutter_full_svg_support,
where they have shipped since v1.0.0 driving SVG @font-face
handling.
Added #
decodeFontIfWoff(Uint8List bytes)— pure-Dart WOFF1 and WOFF2 → SFNT (TTF/OTF) decoder. Implements the full W3C WOFF2 spec includingglyf/loca/hmtxtransformations.loadWoffFontFromAsset({fontFamily, assetPath})— one-call helper that loads a.woff2asset and registers it with Flutter'sFontLoaderso it works inText(...)andTextStyle.loadWoffFontFromBytes({fontFamily, bytes})— the same, for bytes in memory (network, file system, runtime-generated).WoffFontRegistry— batch-registers multiple weight/style variants of one or more font families, typically from a parsed CSS file.extractFontFaceRules(String cssText)— minimal CSS@font-faceparser that returnsCssFontFaceRulevalue objects withfont-family,font-weight(normalised to numeric),font-style,src, andformat.
Known limitations #
- WOFF2 TTC collections are not supported (decoder returns
WoffDecodeResult.malformed). - Flutter Web is not a target platform — modern browsers handle
.woff2natively via@font-facein CSS.