From 48613eca278ad2260bc666cde64dbab20390ea8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Thu, 11 Jan 2018 17:49:43 +0000 Subject: [PATCH] Check for freetype2 version when PangoFT is used Check for freetype2 version, because pangoft works with any version (pangoft availability does not indicate that ft2 is new enough), unlike GTK. On Windows, since pangoft is optional, we check for the presence of freetype2 .pc file first after finding that we have pangoft, and then check for FT_Get_Var_Design_Coordinates() manually by looking for the freetype headers and .lib first, and then looking for the presence of that symbol, since freetype2's Visual Studio build system does not generate a .pc file for us. https://bugzilla.gnome.org/show_bug.cgi?id=773299 --- gtk/meson.build | 2 +- meson.build | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/gtk/meson.build b/gtk/meson.build index fa1f7b2908..45309bc180 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -873,7 +873,7 @@ gtk_deps = [ ] if harfbuzz_dep.found() and pangoft_dep.found() - gtk_deps += [ harfbuzz_dep, ] + gtk_deps += [ harfbuzz_dep, pangoft_dep ] endif if x11_enabled diff --git a/meson.build b/meson.build index 5831dfcbfe..62df80db98 100644 --- a/meson.build +++ b/meson.build @@ -313,12 +313,42 @@ cairogobj_dep = dependency('cairo-gobject', version: cairo_req, required : cc.g pango_dep = dependency('pango', version: pango_req, fallback : ['pango', 'libpango_dep']) -if wayland_enabled or x11_enabled +# Require PangoFT2 if on X11 or wayland +require_pangoft2 = wayland_enabled or x11_enabled + +if require_pangoft2 pangoft_dep = dependency('pangoft2', fallback : ['pango', 'libpangoft2_dep']) else pangoft_dep = dependency('pangoft2', required: false) endif +if pangoft_dep.found() + # Need at least 2.7.1 for FT_Get_Var_Design_Coordinates() + # We get the dependency itself from pango, but pango doesn't care + # about ft2 version, so an extra check is needed. + ft2_dep = dependency('freetype2', version: '>= 2.7.1', required: require_pangoft2) + + # Fallback case: Look for the FreeType2 headers and library manually when its .pc + # file is not available, such as on Visual Studio + if not ft2_dep.found() + ft2lib = ft2_dep + if cc.has_header('ft2build.h') + ft2_libnames = ['freetype', 'freetypemt'] + foreach lib: ft2_libnames + if not ft2_dep.found() + ft2lib = cc.find_library(lib) + # If the FreeType2 library is found, check for FT_Get_Var_Design_Coordinates() + if ft2lib.found() + if cc.has_function('FT_Get_Var_Design_Coordinates', dependencies: ft2lib) + ft2_dep = ft2lib + endif + endif + endif + endforeach + endif + endif +endif + pangocairo_dep = dependency('pangocairo', version: cairo_req, fallback : ['pango', 'libpangocairo_dep']) pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,