papandreou / subset-font

Create a subset of a TrueType/OpenType/WOFF/WOFF2 font using the wasm build of harfbuzz/hb-subset
BSD 3-Clause "New" or "Revised" License
85 stars 6 forks source link

Firefox reporting “Layout: tags aren't arranged alphabetically” with a subsetted font #19

Closed robinwhittleton closed 1 year ago

robinwhittleton commented 1 year ago

First up, it’s very likely that this isn’t a subset-font problem, but I’m a little stumped as to whether it lives here, in harfbuzz, in fontverter or whether I should just fix the original font files.

Either way, when I load a subsetted WOFF2 (a custom variant of Noto Sans) into a page rendered in Firefox I get this error message:

downloadable font: Layout: tags aren't arranged alphabetically. (font-family: "Noto IKEA" style:normal weight:700 stretch:100 src index:0)

(you can see this live by loading https://www.ikea.com/gb/en/ in Firefox and looking at the console)

I’d ideally like this message not to appear, presumably by ordering the layout tags alphabetically 🙂 I’ve been poking around in the various codebases, but I’m a bit out of my comfort zone with fonts, and I’m not making much headway. I’m happy to try to put something together to fix this, but maybe someone could point me at the appropriate place for this ordering to be done?

papandreou commented 1 year ago

Hmm, I don't get that warning when I visit https://www.ikea.com/gb/en/ in Firefox 103.0 on Ubuntu, or a freshly downloaded 103.0.2 on OSX Monterey. Can you tell more about the exact setup where you're seeing it?

I'm not familiar with the concept of tags not being arranged alphabetically, but I'm sure we can figure it out somehow. As a start, you could help rule out fontverter by making sure that both the input and output formats are sfnt/ttf when you call subset-font. That way fontverter and all those wasm-based converters won't actually be in play. If the warning still shows up, it must be a problem with subset-font or harfbuzz(js).

robinwhittleton commented 1 year ago

It shows up in the console. I typically use latest Firefox Nightly on macOS Monterey so it might be specific to that, but I think a non-Nightly-using co-worker also mentioned this at one point. Also, maybe you’ve got warnings toggled off in the Console? It’s hardly a user-facing problem, but it triggers me somewhat 🙂

Screenshot of the error message. It reads: “downloadable font: Layout: tags aren't arranged alphabetically. (font-family: Noto IKEA style:normal weight:700 stretch:100 src index:0) source: https://www.ikea.com/global/assets/fonts/woff2/noto-ikea-700.latin.5d09a799.woff2”

Either way, I’ll try your suggestions and reply back afterwards.

robinwhittleton commented 1 year ago

Having poked at it a bunch more, it feels like the original TTF files might be broken in the same way. At least, regenerating a new base woff using ttf2woff and using that directly throws the same error. So rather than try to fix this in subset-font or ancillaries it’s probably better for me to investigate fixing it at source.

Thanks for the help anyway!