Skip to content

Allow font tweaking widgets to at least run for non-PangoFC fonts on Windows (GTK+-3.x)

Chun-wei Fan requested to merge wip/fanc999/fontchooser.win32.gtk3 into gtk-3-24

Hi,

---disclaimer---

Before I begin, as @matthiasc mentioned, I am aware that there is ongoing work in Pango to use HarfBuzz for all supported platforms for shaping, etc, which will remove the use of FreeType headers and APIs in this code.

Since I am not sure whether there will be a GTK+-3.26.x release series (which will likely prevent bumping Pango requirements in this 3.24.x stable release series), and it looks to me that it will take some time for Pango to transition to use HarfBuzz universally, I thought I might just go ahead to add support for building running the font tweaking widget support for PangoWin32 fonts as well.

---end of disclaimer---

This is a fast port to allow the font tweaking widget code to use HarfBuzz to load a particular PangoWin32Font (which is default on Windows, even when Pango is built with FontConfig/FreeType support) via first transforming the PangoWin32 font into a FT_Face. As I am no means an expert on FreeType/HarfBuzz, and it seems that there are other FreeType code that are being used, I did not attempt at this point to try to directly go from the PangoWin32Font into an hb_face. By doing so, the font tweaking widget code and the font features demo becomes buildable and runnable on Windows even when PangoFT is not present, or when the FontConfig PangoCairo backend is not being used on Windows (and FontConfig can be cumbersome to build and set up on Windows).

This includes support in the autotools builds and instructions/scripts on enabling this feature in the Visual Studio projects.

Note however, for the font tweaking to be applied on Windows for PangoWin32Fonts, some updates are needed in PangoWin32 shaping code or when Pango completes its transition of its shaping code to HarfBuzz on all platforms.

This is a re-write from !291 (closed), where attempts are made to make the changes cleaner and more consolidated, where there is no attempt to try to use DirectWrite, but instead relies more on PangoWin32 APIs and traditional GDI font APIs like what we are using currently in Pango, Cairo and GTK+.

Thanks for bearing with me

With blessings, thank you!

Merge request reports