Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font serialization variations #81

Open
inexorabletash opened this issue Apr 6, 2022 · 2 comments
Open

Font serialization variations #81

inexorabletash opened this issue Apr 6, 2022 · 2 comments

Comments

@inexorabletash
Copy link
Member

When a font (e.g. "Optima-Bold") is provided through the API, whether the source is the OS or a locally installed font, the actual data of the font may vary across browsers, OSes, or even time on the same device.

  • The font could be a non-OpenType version (e.g. Type 1, SVG, or some other format). See Non-OpenType fonts #19
  • The font could be a future format that is not serialized using SFNT
  • The font could be an alternate version from a different foundry.
  • The font could include bug fixes or improvements
  • The font could include additional data, e.g. expanded to include glyphs from other scripts, etc
    ... and much much more!

There is the case where the underlying font data is actually identical, but the SFNT serialization has changed in ways such that the files are not byte-identical, e.g. the tables are in a different order, or e.g. within the name table the entries are in a different order.

Do we need browsers to normalize this? Or is this the equivalent of e.g. a JPEG/JFIF file having markers in an undefined order when uploading <input type=file>?

The expected use case is that font data is parsed with a small number of robust libraries (e.g. HarfBuzz and FreeType) which conceal this from the calling code, so for most API users this will not be an issue.

@rcombs
Copy link

rcombs commented Apr 22, 2022

vary across browsers

Which cases are you expecting this to happen in? TTC handling, maybe? I would expect that for regular TTF or OTF files, the browser would simply hand the caller the contents of the on-disk file.

@inexorabletash
Copy link
Member Author

vary across browsers

Which cases are you expecting this to happen in? TTC handling, maybe? I would expect that for regular TTF or OTF files, the browser would simply hand the caller the contents of the on-disk file.

That's my expectation as well for most implementations. But I could imagine a UA that does things differently, e.g. a UA that bundles a set of fonts, and the font data for those evolves over time e.g. to support new writing scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants