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
This commit is contained in:
Руслан Ижбулатов 2018-01-11 17:49:43 +00:00 committed by Chun-wei Fan
parent 69e1128cd3
commit 48613eca27
2 changed files with 32 additions and 2 deletions

View File

@ -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

View File

@ -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,