Skip to content

Pango-1.x: Add some DirectWrite support as a supplement

Chun-wei Fan requested to merge pango1-dwrite into main

Hi,

This attempts to add DirectWrite support as a supplement for Windows support in Pango, where:

  • We now use the DirectWrite APIs to look for the installed fonts on the system.
  • Use DirectWrite to (improve and/or implement) acquiring attributes for the fonts, such as stretch, monospaced fonts and font hinting. For this, we take out the parts that we warn about fallbacks, since acquiring these properties would cause them and we should be in a better state as we acquire more items for the fonts. (address issues like gtk#5033 (closed) in GTK).
  • Colored Emoji support without FontConfig on Windows (issue #302 (closed))! This, however, requires a pretty recent Cairo build such as 1.17.6 or later since we need DirectWrite support in Cairo that was only made upstream recently, so we check for that during configure before enabling this.

This also attempts to simplify the creation of our hb_font_t's on Windows, if DirectWrite and/or GDI support is enabled in the HarfBuzz build.

Note that this is currently only implemented for the Unicode version of LOGFONT's (i.e. LOGFONTW), in terms of querying the font description using LOGFONT's, since DirectWrite is meant to interop with GDI-era APIs using LOGFONTW's. Sadly, DirectWrite does not provide a way to look for default settings for font variants, i.e. small caps, and so in a font, so no support for getting the newer PANGO_VARIANT_* items.

Many thanks to @lb90 for the initial logic and code for the upcoming Pango2, which this code is based upon.

Edited by Chun-wei Fan

Merge request reports