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,