Skip to content

Windows color fonts

Adrian Johnson requested to merge ajohnson/cairo:win32-color-fonts into master

This adds color font support for windows. GDI does not support color fonts so we have to use the DWrite API. Mozilla already have a dwrite font backend for cairo. I have taken Mozilla's cairo dwrite, integrated it into our meson build, fixed a few issues, and added color font support. it works with COLR and SVG fonts. CDBT fonts are not working (seems to be a font metrics problem), and I don't have any SBIX fonts to test.

Still todo:

  • Figure out why CDBT fonts are not working
  • Check that I am freeing all objects created
  • COLR fonts can include the current text color in their rendering. Update cairo to pass this color through _cairo_scaled_glyph_lookup. The latest freetype with COLR support also supports this so the FT backend will need updating as well.
  • I am thinking about whether to add color font support to cairo-win32-font by loading a the font in DW as well as GDI to retrieve color images. A problem I found is the metrics differ slightly between DW and GDI for the same font. So I think I will only support color fonts in DW.
  • The dwrite font backend imported from mozilla contains some public API for rendering parameters. I have not yet decided what to do with these.

Update: I've remove the extra public API from the imported mozilla code. We can always add it back later if we find it is needed. I don't think CDBT fonts are supported on win32.

Edited by Adrian Johnson

Merge request reports