fontations icon indicating copy to clipboard operation
fontations copied to clipboard

Analyse whether Fontations meets requirements of FontConfig

Open drott opened this issue 2 years ago • 3 comments

Filing this issue to track FontConfig's font parsing and other dependencies on FT in order to estimate complexity of removal of FreeType in Chromium.

@behdad helpfully provided pointers to FontConfig's use of FreeType: https://github.com/behdad/fontconfig/blob/master/src/fcfreetype.c https://github.com/behdad/fontconfig/blob/master/fontconfig/fcfreetype.h

The second header is part of FontConfig's public API.

For removal of FreeType in Chrome, we'd need to find replacements for this functionality through Skrifa and read-fonts.

Since FontConfig exposes FT_Face at its own interface, I am not sure if changes to FontConfig's interface are needed, and whether FC uses the functions in fcfreetype.h internally.

drott avatar Oct 23 '23 17:10 drott

I’m only somewhat familiar with fontconfig internals so checking my own assumptions:

  • If the font database already exists, then the fontconfig client shouldn’t need FreeType at all? Is such a build currently possible?
  • Can the client itself do a rebuild of the database? If so, can fontconfig expose a generic interface that can be implemented to supply the necessary metadata?

dfrg avatar Oct 24 '23 14:10 dfrg

I’m only somewhat familiar with fontconfig internals so checking my own assumptions:

  • If the font database already exists, then the fontconfig client shouldn’t need FreeType at all? Is such a build currently possible?

For most of the functionality you are right indeed. Some functions (which we don't use) still would call into FreeType, like FcFreeTypeCharIndex, that some other clients use, but we use HarfBuzz for that.

I'm not aware of any such build config though.

  • Can the client itself do a rebuild of the database? If so, can fontconfig expose a generic interface that can be implemented to supply the necessary metadata?

I think the API is all there. In FcConfig API mostly.

behdad avatar Oct 24 '23 18:10 behdad

Just a ping to ensure this doesn’t fall by the wayside. I think the next step is to determine if Chrome ever calls into fontconfig in a way that might trigger an in-process rebuild of the database. If not, we can add a build config that makes FreeType an optional dependency. Otherwise, we’ll need to find a way to provide the required metadata from skrifa.

dfrg avatar Mar 04 '24 15:03 dfrg