summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml7
-rw-r--r--.gitlab-ci/fedora.Dockerfile2
-rw-r--r--meson.build60
-rw-r--r--pango/meson.build5
-rw-r--r--pango/pangofc-fontmap.c10
-rw-r--r--pango/pangoft2.h3
-rw-r--r--pango/pangoxft.h3
-rw-r--r--tests/meson.build1
8 files changed, 61 insertions, 30 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c287010c..0d1433cb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,9 +8,10 @@ stages:
variables:
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
MESON_TEST_TIMEOUT_MULTIPLIER: 2
+ FEDORA_IMAGE: registry.gitlab.gnome.org/gnome/pango/fedora:v3
linux-fedora:
- image: registry.gitlab.gnome.org/gnome/pango/fedora:v2
+ image: $FEDORA_IMAGE
stage: build
needs: []
variables:
@@ -34,7 +35,7 @@ linux-fedora:
- "${CI_PROJECT_DIR}/_build/fontlist.txt"
asan-build:
- image: registry.gitlab.gnome.org/gnome/pango/fedora:v2
+ image: $FEDORA_IMAGE
tags: [ asan ]
stage: analysis
needs: []
@@ -78,7 +79,7 @@ msys2-mingw64:
- _build/fontlist.txt
reference:
- image: registry.gitlab.gnome.org/gnome/pango/fedora:v1
+ image: $FEDORA_IMAGE
stage: docs
needs: []
variables:
diff --git a/.gitlab-ci/fedora.Dockerfile b/.gitlab-ci/fedora.Dockerfile
index f2240cac..9447bdb1 100644
--- a/.gitlab-ci/fedora.Dockerfile
+++ b/.gitlab-ci/fedora.Dockerfile
@@ -41,7 +41,7 @@ RUN dnf -y install \
thai-scalable-waree-fonts \
&& dnf clean all
-RUN pip3 install meson==0.53.1
+RUN pip3 install meson==0.54.3
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
diff --git a/meson.build b/meson.build
index 504b68b5..98f4e372 100644
--- a/meson.build
+++ b/meson.build
@@ -8,7 +8,7 @@ project('pango', 'c', 'cpp',
# https://github.com/mesonbuild/meson/issues/2289
'c_std=gnu99',
],
- meson_version : '>= 0.50.0')
+ meson_version : '>= 0.54.0')
add_project_arguments([ '-D_POSIX_C_SOURCE=200809L', '-D_POSIX_THREAD_SAFE_FUNCTIONS', '-D_GNU_SOURCE', ], language: 'c')
@@ -269,17 +269,15 @@ endif
pango_deps += harfbuzz_dep
-# Only use FontConfig fallback when required or requested
-
+# If option is 'auto' or 'enabled' it is not required to find fontconfig on the
+# system because a fallback is done at the end. Override 'disabled' option on
+# platforms that requires it.
fontconfig_option = get_option('fontconfig')
-
-fontconfig_sys_required = (host_system != 'windows' and host_system != 'darwin')
-if fontconfig_sys_required and fontconfig_option.disabled()
- error('Fontconfig is required on this platform (pass -Dfontconfig=enabled or -Dfontconfig=auto)')
+fontconfig_required = host_system not in ['windows', 'darwin']
+if not fontconfig_option.disabled() or fontconfig_required
+ fontconfig_option = false
endif
-fontconfig_required = fontconfig_sys_required or fontconfig_option.enabled()
-
fontconfig_dep = dependency('fontconfig', version: fontconfig_req_version, required: fontconfig_option)
if fontconfig_dep.found()
fontconfig_pc = 'fontconfig'
@@ -294,15 +292,19 @@ else
endif
endif
-if fontconfig_required and not fontconfig_dep.found()
+# Do the fallback now if fontconfig has not been found on the system. Override
+# user option on platforms that always require fontconfig.
+fontconfig_option = fontconfig_required ? true : get_option('fontconfig')
+if not fontconfig_dep.found()
fontconfig_dep = dependency('fontconfig', version: fontconfig_req_version,
- fallback: ['fontconfig', 'fontconfig_dep'])
+ fallback: ['fontconfig', 'fontconfig_dep'],
+ required: fontconfig_option)
endif
if fontconfig_dep.found()
pango_deps += fontconfig_dep
- if fontconfig_pc == 'fontconfig'
+ if fontconfig_dep.type_name() != 'library'
if fontconfig_dep.version().version_compare('>=2.12.92')
pango_conf.set('HAVE_FCWEIGHTFROMOPENTYPEDOUBLE', 1)
endif
@@ -318,9 +320,17 @@ else
endif
message('fontconfig has FcWeightFromOpenTypeDouble: ' + res)
+# If option is 'auto' or 'enabled' it is not required to find freetype2 on the
+# system because a fallback is done at the end. Override 'disabled' option on
+# if fontconfig has been found.
+freetype_option = get_option('freetype')
+freetype_required = fontconfig_dep.found()
+if not freetype_option.disabled() or freetype_required
+ freetype_option = false
+endif
+
# The first version of freetype with a pkg-config file is 2.1.5
-# We require both fontconfig and freetype if we are to have either.
-freetype_dep = dependency('freetype2', required: get_option('freetype'))
+freetype_dep = dependency('freetype2', required: freetype_option)
if freetype_dep.found()
freetype2_pc = 'freetype2'
@@ -328,7 +338,7 @@ else
if cc.get_id() == 'msvc' and cc.has_header('ft2build.h')
foreach ft2_lib: ['freetype', 'freetypemt']
if not freetype_dep.found()
- freetype_dep = cc.find_library(ft2_lib, required: get_option('freetype'))
+ freetype_dep = cc.find_library(ft2_lib, required: freetype_option)
if freetype_dep.found()
freetype2_lib = '-l@0@'.format(ft2_lib)
endif
@@ -337,8 +347,10 @@ else
endif
endif
-if fontconfig_required and not freetype_dep.found()
- freetype_dep = dependency('freetype2', required: get_option('freetype'),
+# Do the fallback now if freetype2 has not been found on the system.
+freetype_option = freetype_required ? true : get_option('freetype')
+if not freetype_dep.found()
+ freetype_dep = dependency('freetype2', required: freetype_option,
fallback: ['freetype2', 'freetype_dep'])
endif
@@ -371,14 +383,21 @@ if host_system == 'darwin'
pango_deps += dependency('appleframeworks', modules: [ 'CoreFoundation', 'ApplicationServices' ])
endif
+# If option is 'auto' or 'enabled' it is not required to find cairo on the
+# system because a fallback is done at the end.
+cairo_option = get_option('cairo')
+if not cairo_option.disabled()
+ cairo_option = false
+endif
+
cairo_found_type = ''
-cairo_dep = dependency('cairo', version: cairo_req_version, required: false)
+cairo_dep = dependency('cairo', version: cairo_req_version, required: cairo_option)
if cairo_dep.found()
cairo_found_type = cairo_dep.type_name()
else
if cc.get_id() == 'msvc' and cc.has_header('cairo.h')
- cairo_dep = cc.find_library('cairo', required: false)
+ cairo_dep = cc.find_library('cairo', required: cairo_option)
cairo_found_type = 'library'
endif
endif
@@ -387,7 +406,8 @@ endif
# in a declarative way
if not cairo_dep.found()
cairo_dep = dependency('cairo', version: cairo_req_version,
- fallback: ['cairo', 'libcairo_dep'], required: get_option('cairo'))
+ fallback: ['cairo', 'libcairo_dep'], required: get_option('cairo'),
+ default_options: ['freetype=enabled', 'fontconfig=enabled'])
cairo_found_type = cairo_dep.type_name()
endif
diff --git a/pango/meson.build b/pango/meson.build
index 0b87b644..91261274 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -152,6 +152,7 @@ libpango_dep = declare_dependency(
dependencies: pango_deps,
sources: pango_dep_sources,
)
+meson.override_dependency('pango', libpango_dep)
pango_pkg_requires = ['gobject-2.0']
if harfbuzz_dep.type_name() == 'pkgconfig'
@@ -293,6 +294,7 @@ if build_pangoft2
dependencies: pango_deps + [ libpango_dep ],
sources: pangoft2_dep_sources,
)
+ meson.override_dependency('pangoft2', libpangoft2_dep)
pkgconfig.generate(libpangoft2,
name: 'Pango FT2 and Pango Fc',
@@ -382,6 +384,7 @@ if xft_dep.found() and fontconfig_dep.found()
dependencies: pango_deps + [ libpango_dep, libpangoft2_dep ],
sources: pangoxft_dep_sources,
)
+ meson.override_dependency('pangoxft', libpangoxft_dep)
pkgconfig.generate(libpangoxft,
name: 'Pango Xft',
@@ -441,6 +444,7 @@ if host_system == 'windows'
include_directories: root_inc,
dependencies: pango_deps + [ libpango_dep ],
)
+ meson.override_dependency('pangowin32', libpangowin32_dep)
pkgconfig.generate(libpangowin32,
name: 'Pango Win32',
@@ -547,6 +551,7 @@ if cairo_dep.found()
dependencies: pango_deps + [ libpango_dep ],
sources: pangocairo_dep_sources,
)
+ meson.override_dependency('pangocairo', libpangocairo_dep)
# Create pangocairo.pc according to whether we found Cairo
# manually
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 0f211c46..3b7f1915 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -2979,20 +2979,24 @@ pango_fc_family_get_face (PangoFontFamily *family,
{
PangoFcFamily *fcfamily = PANGO_FC_FAMILY (family);
int i;
+ const char *style = name;
ensure_faces (fcfamily);
- if (name == NULL)
- name = "Regular"; /* This name always exists in fontconfig */
+ if (style == NULL)
+ style = "Regular";
for (i = 0; i < fcfamily->n_faces; i++)
{
PangoFontFace *face = PANGO_FONT_FACE (fcfamily->faces[i]);
- if (strcmp (name, pango_font_face_get_face_name (face)) == 0)
+ if (strcmp (style, pango_font_face_get_face_name (face)) == 0)
return face;
}
+ if (name == NULL && fcfamily->n_faces > 0)
+ return PANGO_FONT_FACE (fcfamily->faces[0]);
+
return NULL;
}
diff --git a/pango/pangoft2.h b/pango/pangoft2.h
index 892aa039..96228316 100644
--- a/pango/pangoft2.h
+++ b/pango/pangoft2.h
@@ -67,7 +67,8 @@ typedef struct _PangoFT2FontMap PangoFT2FontMap;
*
* Function type for doing final config tweaking on prepared FcPatterns.
*/
-typedef PangoFcSubstituteFunc PangoFT2SubstituteFunc;
+typedef void (*PangoFT2SubstituteFunc) (FcPattern *pattern,
+ gpointer data);
/* Calls for applications */
diff --git a/pango/pangoxft.h b/pango/pangoxft.h
index eb17f97c..0852c202 100644
--- a/pango/pangoxft.h
+++ b/pango/pangoxft.h
@@ -85,7 +85,8 @@ typedef struct _PangoXftFont PangoXftFont;
*
* Function type for doing final config tweaking on prepared FcPatterns.
*/
-typedef PangoFcSubstituteFunc PangoXftSubstituteFunc;
+typedef void (*PangoXftSubstituteFunc) (FcPattern *pattern,
+ gpointer data);
/* Calls for applications
*/
diff --git a/tests/meson.build b/tests/meson.build
index b962a758..ba96ac2c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -95,7 +95,6 @@ test_breaks_data = [
'breaks/one',
'breaks/two',
'breaks/three',
- 'breaks/four',
]
if thai_dep.found()