- Issue created by @pdureau
- 🇫🇷France pdureau Paris
It is hard and heavy to extract icons from a proper font file (woff, ttf...).
Yes, but codepoints files are a mess -sometimes CSV, sometimes JSON, sometimes XML... no standardized structure) and not always available.
Maybe it is possible to extract the icon list using a lib (or a subset of a lib to avoid a dependency) like https://github.com/dompdf/php-font-lib
If we focus on only WOFF 2 for now, because all DS seems to propose this format, it may be simpler:
- Bootstrap 5: bootstrap-icons.woff & bootstrap-icons.woff2
- Font awesome: fa-brands-400.ttf fa-regular-400.woff2 fa-v4compatibility.ttf fa-brands-400.woff2 fa-solid-900.ttf fa v4compatibility.woff2 fa-regular-400.ttf fa-solid-900.woff2
- Feather: ???
- Material Symbols: https://fonts.gstatic.com/s/materialsymbolsoutlined/v207/{hash}.woff2
- Assigned to mogtofu33
- 🇫🇷France pdureau Paris
I have added a first draft of Woff2Extractor, inspired from https://github.com/teicee/php-woff-converter
https://git.drupalcode.org/project/ui_icons/-/merge_requests/20
What do you think?
- Status changed to Postponed
4 months ago 12:57pm 12 September 2024 - 🇫🇷France pdureau Paris
So sorry, https://github.com/teicee/php-woff-converter was loading woff1 files, not woff2 files.
- 🇫🇷France pdureau Paris
If we continue with Woff1, we an test with Bootstrap 5 & also Icomoon
- Assigned to pdureau
- Status changed to Needs work
4 months ago 1:44pm 13 September 2024 - 🇫🇷France pdureau Paris
Ok, we start with Woff1
but once Woff2 is ready, replace Material symbols example SVG icon pack by a Woff2 one, and add Material icons
- 🇫🇷France pdureau Paris
So, Woff is a wrapper around TrueType, OpenType, and Open Font Format.
So let's start with a TTF extractor and test with FontAwesome which has a TrueType version: https://fontawesome.com/v6/download
Once this one works, we can add an interface:
interface FontIconExtractorInterface extends IconExtractorInterface { public function parseTable(array $table): array; }
So,
Woff1Extractor::discoverIcons()
can callTtfExtractor::parseTable()
once the wrapper is scanned and the glyph table discovered. - 🇫🇷France mogtofu33
I would prefer to not include classes to maintain for ttf/woff support when there is tested library like dompdf/php-font-lib.
The font Extractor should include metadata alternatives to discover icons with json, codepoints and yml:
- Bootstrap icons font: woff file and/or bootstrap.json
- Font Awesome: TTF file and/or metadata icons.json or better icons.yml (included with FontAwesome for the web)
- Feather: json file generated in npm package
- Material: codepoints file included with font, CDN font to load css matching doc, see variablefon
I will push a proposition of font extractor that support ttf/woff with dompdf/php-font-lib and json/codepoints/yml definition files.
- 🇫🇷France pdureau Paris
We can do a
ui_icons_fonts
sub-module, and move it to thedrupal/ui_icons_fonts
module before tagging the first RC