WIP: Font Chooser Widget: Make tweaking page work for Win32 fonts too
The current implementation of the tweaking portion in the font chooser widget currently assumes that PangoFT2 is being used, which is not normally the case on Windows unless such support is built and is explicitly enabled by setting PANGOCAIRO_BACKEND. This means without building with PangoFT2 and enabling it this code will simply not work.
This is a initial attempt to port this to work with PangoWin32 fonts (i.e. Windows native LOGFONT's). This is a quick port, as this still makes use of HarfBuzz and FreeType, but attempts to reduce the additional dependencies to the minimum by:
-Not requiring the PangoFT2 support (and setting PANGOCAIRO_BACKEND).
-ISO-Codes is not required, on any Windows build (including the PangoFT2 builds), we use the Windows APIs instead to retrieve the localized locale (language) names into a HashTable where we could look up.
-The HarfBuzz that we use here only needs to be built with FreeType support, as far as I know, which makes building HarfBuzz and FreeType quite hassle-free as there are CMake build files for them to build with Visual Studio and MinGW and its derivatives.
This port, to future-proof things, makes use of DirectWrite as we switch between a PangoWin32 font (LOGFONTW) to a FT_Face so that we can load it up with HarfBuzz and to read the font tables as we go. Moving to a fully Uniscribe/DirectWrite implementation might be possible eventually, but is not covered in this attempt since it would involve much more work and may not work across different Windows versions (7, 8.1, 10) as DirectWrite evolves between these Windows versions.DirectWrite is not pursued for now, until the time comes that we move Cairo and related items to D2D and DirectWrite and so.
There might be a lot of things that are missed in the process, and it could be slow on Windows (which may or may not be related to this work), but this does make the font features demo run more or less in a way we expect. Like in MR !495, some updates are needed in PangoWin32 to make things work fully, but since we are moving towards using HarfBuzz for shaping on all platforms, I am holding off anything to that at this point (although it looks like it would still take a while).
When this get good enough, I will also back ported this into GTK+-3.24.x (MR !495).
With blessings, thank you!