From 713fab7596f860531b821ede21c69b24faacef2b Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 8 Aug 2022 18:56:24 +0800 Subject: [PATCH] win32/generate-msvcprojs.mak: Simplify enabling PangoFT2 ... in the gtk-3 Visual Studio project. This will allow one who wishes to use the font features items that uses the older PangoFT2-based APIs that is used before Pango 1.44.0 and HarfBuzz-2.2.0 an easier way to do that, by regenerating the gtk-3 project files with the necessary items enabled. The font features demo still needs to be explicitly enabled, though, as before. --- win32/README_FEATURES_MSVC.md | 10 ++++---- win32/generate-msvcprojs.mak | 46 ++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/win32/README_FEATURES_MSVC.md b/win32/README_FEATURES_MSVC.md index 72c60da07b..fedcdb10b4 100644 --- a/win32/README_FEATURES_MSVC.md +++ b/win32/README_FEATURES_MSVC.md @@ -61,12 +61,12 @@ the Pango 1.44.0 and HarfBuzz 2.2.0 (or later) headers and libraries to ensure that you have your HarfBuzz .lib file named as such, which is the default .lib name for HarfBuzz builds. -Alternatively, they can be manually enabled by making sure that -`HAVE_HARFBUZZ` and `HAVE_PANGOFT2` are defined in `config.h.win32`, +Alternatively, they can be manually enabled by running `nmake /f generate-msvc.mak regenerate-gtk-vsproj FONT_FEATURES_USE_PANGOFT2=1` meaning that PangoFT2 must be present, which depends on HarfBuzz, -FontConfig and FreeType. You will then need to add to the `gtk3` -projects the .lib's of PangoFT2, HarfBuzz and FreeType in the -`Additional Libraries` entry under the linker settings. +FontConfig and FreeType. You will then need to ensure the `gtk-3` +projects have the correct .lib's of PangoFT2, HarfBuzz and FreeType +in the `Additional Libraries` entry under the linker settings, as they +assume the most common names are used there. Please note that the font features demo is not built into gtk3-demo by default. To do that, run in a Visual Studio command prompt: diff --git a/win32/generate-msvcprojs.mak b/win32/generate-msvcprojs.mak index 507cb38da6..ef2f5d0a13 100644 --- a/win32/generate-msvcprojs.mak +++ b/win32/generate-msvcprojs.mak @@ -331,13 +331,13 @@ gtk-3.win32.vs10.sourcefiles.filters: vs9\$(GDK_VS9_PROJ): gdk-3.sourcefiles vs9\$(GDK_VS9_PROJ)in vs9\$(GDKWIN32_VS9_PROJ).pre: gdk3-win32.sourcefiles vs9\$(GDKWIN32_VS9_PROJ)in vs9\$(GDKBROADWAY_VS9_PROJ): gdk3-broadway.sourcefiles vs9\$(GDKBROADWAY_VS9_PROJ)in -vs9\$(GTK_VS9_PROJ): gtk-3.sourcefiles vs9\$(GTK_VS9_PROJ)in +vs9\$(GTK_VS9_PROJ).pre: gtk-3.sourcefiles vs9\$(GTK_VS9_PROJ)in vs9\$(GAILUTIL_VS9_PROJ): gailutil-3.sourcefiles vs9\$(GAILUTIL_VS9_PROJ)in vs10\$(GDK_VS1X_PROJ): gdk-3.vs10.sourcefiles vs10\$(GDK_VS1X_PROJ)in vs10\$(GDKWIN32_VS1X_PROJ).pre: gdk3-win32.vs10.sourcefiles vs10\$(GDKWIN32_VS1X_PROJ)in vs10\$(GDKBROADWAY_VS1X_PROJ): gdk3-broadway.vs10.sourcefiles vs10\$(GDKBROADWAY_VS1X_PROJ)in -vs10\$(GTK_VS1X_PROJ): gtk-3.vs10.sourcefiles vs10\$(GTK_VS1X_PROJ)in +vs10\$(GTK_VS1X_PROJ).pre: gtk-3.vs10.sourcefiles vs10\$(GTK_VS1X_PROJ)in vs10\$(GAILUTIL_VS1X_PROJ): gailutil-3.vs10.sourcefiles vs10\$(GAILUTIL_VS1X_PROJ)in vs10\$(GDK_VS1X_PROJ_FILTERS): gdk-3.vs10.sourcefiles.filters vs10\$(GDK_VS1X_PROJ_FILTERS)in @@ -360,14 +360,14 @@ vs10\$(DEMO_VS1X_PROJ_FILTERS): gtk3-demo.vs10.sourcefiles.filters vs10\$(DEMO_V vs9\$(GDKWIN32_VS9_PROJ).pre \ vs9\$(GDKBROADWAY_VS9_PROJ) \ vs9\$(GDK_VS9_PROJ) \ -vs9\$(GTK_VS9_PROJ) \ +vs9\$(GTK_VS9_PROJ).pre \ vs9\$(GAILUTIL_VS9_PROJ) \ vs9\$(BROADWAYD_VS9_PROJ) \ vs9\$(DEMO_VS9_PROJ).pre \ vs10\$(GDKWIN32_VS1X_PROJ).pre \ vs10\$(GDKBROADWAY_VS1X_PROJ) \ vs10\$(GDK_VS1X_PROJ) \ -vs10\$(GTK_VS1X_PROJ) \ +vs10\$(GTK_VS1X_PROJ).pre \ vs10\$(GAILUTIL_VS1X_PROJ) \ vs10\$(BROADWAYD_VS1X_PROJ) \ vs10\$(DEMO_VS1X_PROJ).pre \ @@ -415,6 +415,44 @@ vs9\$(GDKWIN32_VS9_PROJ) vs10\$(GDKWIN32_VS1X_PROJ): @move $** $@ !endif +# Generate the gtk-3 project with or without using the older PangoFT2 + +# HarfBuzz APIs for the font features support (this code is not used if +# Pango 1.44.0 and HarfBuzz 2.2.0 or later are used) +!ifdef FONT_FEATURES_USE_PANGOFT2 +vs9\$(GTK_VS9_PROJ): vs9\$(GTK_VS9_PROJ).pre2 + @echo Generating final $@ using older PangoFT2 APIs... + @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \ + --instring="AdditionalDependencies=\"$$(" \ + --outstring="AdditionalDependencies=\"$(DEMO_DEP_LIBS_PANGOFT2_VS9) $$(" + @del $** + +vs10\$(GTK_VS1X_PROJ): vs10\$(GTK_VS1X_PROJ).pre2 + @echo Generating final $@ using older PangoFT2 APIs... + @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \ + --instring=";%(AdditionalDependencies)<" \ + --outstring=";$(DEMO_DEP_LIBS_PANGOFT2_VS1X);%(AdditionalDependencies)<" + @del $** + +vs9\$(GTK_VS9_PROJ).pre2: vs9\$(GTK_VS9_PROJ).pre + @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \ + --instring="$$(GtkDefines" \ + --outstring="HAVE_HARFBUZZ;HAVE_PANGOFT;$$(GtkDefines" + @del $** + +vs10\$(GTK_VS1X_PROJ).pre2: vs10\$(GTK_VS1X_PROJ).pre + @$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \ + --instring="$$(GtkDefines);%" \ + --outstring="HAVE_HARFBUZZ;HAVE_PANGOFT;$$(GtkDefines);%" + @del $** +!else +vs9\$(GTK_VS9_PROJ): vs9\$(GTK_VS9_PROJ).pre +vs10\$(GTK_VS1X_PROJ): vs10\$(GTK_VS1X_PROJ).pre + +vs9\$(GTK_VS9_PROJ) vs10\$(GTK_VS1X_PROJ): + @echo Generating final $@... + @move $** $@ +!endif + !ifdef FONT_FEATURES_DEMO !ifdef FONT_FEATURES_USE_PANGOFT2 DEMO_MSG = with font features demo using PangoFT2