diff options
author | Simon McVittie <smcv@debian.org> | 2020-12-17 13:54:19 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2020-12-17 13:54:19 +0000 |
commit | 19f5812a7a77d3aa4511a4081f7e6506dcd20429 (patch) | |
tree | 3d8c57decfb5a1946bd9cbc13c248e56323da957 | |
parent | 87d94eafbcc2bad0c47e5bb9bbcf8135516f1edb (diff) | |
parent | a39fea44c7c9f982fcca6d639929545dd3e09eb7 (diff) |
New upstream version 1.48.0
-rw-r--r-- | NEWS | 8 | ||||
-rwxr-xr-x | make-release.sh | 4 | ||||
-rw-r--r-- | meson.build | 62 | ||||
-rw-r--r-- | meson_options.txt | 5 | ||||
-rw-r--r-- | pango/meson.build | 8 | ||||
-rw-r--r-- | pango/pangofc-font.c | 2 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 27 | ||||
-rw-r--r-- | pango/pangoft2.h | 3 | ||||
-rw-r--r-- | pango/pangoxft.h | 3 | ||||
-rw-r--r-- | pango/shape.c | 23 | ||||
-rw-r--r-- | subprojects/freetype2.wrap | 16 | ||||
-rw-r--r-- | tests/gen-all-unicode.py | 2 | ||||
-rw-r--r-- | tests/gen-installed-test.py | 2 | ||||
-rw-r--r-- | tests/meson.build | 6 | ||||
-rw-r--r-- | tests/test-shape.c | 6 |
15 files changed, 122 insertions, 55 deletions
@@ -1,3 +1,11 @@ +Overview of changes in 1.48.0 +============================= +- docs: Clarify use of PangoAnalysis in shaping +- fontconfig: Make pango_font_family_get_face more reliable +- introspection: Fix use of PangoFcSubstituteFunc +- introspection: Skip fontconfig types +- build: Use yielding meson feature for introspection + Overview of changes in 1.47.0 ============================= - Add pango_language_get_preferred diff --git a/make-release.sh b/make-release.sh index d0b4b750..1c064689 100755 --- a/make-release.sh +++ b/make-release.sh @@ -10,10 +10,10 @@ if [ -d ${release_build_dir} ]; then fi # we include gtk-doc since we need the gtk-doc-for-gtk4 branch -meson setup --force-fallback-for gtk-doc ${release_build_dir} || exit +meson setup ${release_build_dir} || exit # make the release tarball -meson dist -C${release_build_dir} --include-subprojects || exit +meson dist -C${release_build_dir} || exit # now build the docs meson configure -Dgtk_doc=true ${release_build_dir} || exit diff --git a/meson.build b/meson.build index 36fc4112..154eb20f 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('pango', 'c', 'cpp', - version: '1.47.0', + version: '1.48.0', license: 'LGPLv2.1+', default_options: [ 'buildtype=debugoptimized', @@ -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: get_option('cairo')) +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/meson_options.txt b/meson_options.txt index 5aa7c795..235b8a48 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,8 +4,9 @@ option('gtk_doc', value: false) option('introspection', description: 'Build the GObject introspection data for Pango', - type: 'boolean', - value: true) + type: 'feature', + value: 'auto', + yield: true) option('install-tests', description : 'Install tests', type: 'boolean', diff --git a/pango/meson.build b/pango/meson.build index 4c055f52..91261274 100644 --- a/pango/meson.build +++ b/pango/meson.build @@ -121,7 +121,8 @@ libpango = library( pango_dep_sources = [pango_enum_h] -build_gir = get_option('introspection') +gir = find_program('g-ir-scanner', required : get_option('introspection')) +build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled()) if build_gir gir_args = [ @@ -151,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' @@ -292,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', @@ -381,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', @@ -440,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', @@ -546,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-font.c b/pango/pangofc-font.c index 01520cb4..cf6b427f 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -1069,7 +1069,7 @@ pango_fc_font_get_languages (PangoFcFont *font) } /** - * pango_fc_font_get_pattern: + * pango_fc_font_get_pattern: (skip) * @font: a #PangoFcFont * * Returns the FcPattern that @font is based on. diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 0f211c46..764336ae 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -182,6 +182,7 @@ struct _PangoFcFace FcPattern *pattern; guint fake : 1; + guint regular : 1; }; struct _PangoFcFamily @@ -2852,6 +2853,7 @@ ensure_faces (PangoFcFamily *fcfamily) fcfamily->faces[i++] = create_face (fcfamily, "Bold", NULL, TRUE); fcfamily->faces[i++] = create_face (fcfamily, "Italic", NULL, TRUE); fcfamily->faces[i++] = create_face (fcfamily, "Bold Italic", NULL, TRUE); + fcfamily->faces[0]->regular = 1; } else { @@ -2865,12 +2867,17 @@ ensure_faces (PangoFcFamily *fcfamily) gboolean has_face [4] = { FALSE, FALSE, FALSE, FALSE }; PangoFcFace **faces; gint num = 0; + int regular_weight; + int regular_idx; fontset = fcfamily->patterns; /* at most we have 3 additional artifical faces */ faces = g_new (PangoFcFace *, fontset->nfont + 3); + regular_weight = 0; + regular_idx = -1; + for (i = 0; i < fontset->nfont; i++) { const char *style, *font_style = NULL; @@ -2895,12 +2902,23 @@ ensure_faces (PangoFcFamily *fcfamily) if (FcPatternGetString (fontset->fonts[i], FC_STYLE, 0, (FcChar8 **)(void*)&font_style) != FcResultMatch) font_style = NULL; + if (font_style && strcmp (font_style, "Regular") == 0) + { + regular_weight = FC_WEIGHT_MEDIUM; + regular_idx = num; + } + if (weight <= FC_WEIGHT_MEDIUM) { if (slant == FC_SLANT_ROMAN) { has_face[REGULAR] = TRUE; style = "Regular"; + if (weight > regular_weight) + { + regular_weight = weight; + regular_idx = num; + } } else { @@ -2938,6 +2956,9 @@ ensure_faces (PangoFcFamily *fcfamily) if ((has_face[REGULAR] || has_face[ITALIC] || has_face[BOLD]) && !has_face[BOLD_ITALIC]) faces[num++] = create_face (fcfamily, "Bold Italic", NULL, TRUE); + if (regular_idx != -1) + faces[regular_idx]->regular = 1; + faces = g_renew (PangoFcFace *, faces, num); qsort (faces, num, sizeof (PangoFcFace *), compare_face); @@ -2982,14 +3003,12 @@ pango_fc_family_get_face (PangoFontFamily *family, ensure_faces (fcfamily); - if (name == NULL) - name = "Regular"; /* This name always exists in fontconfig */ - 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 ((name != NULL && strcmp (name, pango_font_face_get_face_name (face)) == 0) || + (name == NULL && PANGO_FC_FACE (face)->regular)) return face; } 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/pango/shape.c b/pango/shape.c index efdb3177..04624b00 100644 --- a/pango/shape.c +++ b/pango/shape.c @@ -45,14 +45,18 @@ * @analysis: #PangoAnalysis structure from pango_itemize() * @glyphs: glyph string in which to store results * - * Given a segment of text and the corresponding - * #PangoAnalysis structure returned from pango_itemize(), - * convert the characters into glyphs. You may also pass - * in only a substring of the item from pango_itemize(). + * Given a segment of text and the corresponding #PangoAnalysis structure + * returned from pango_itemize(), convert the characters into glyphs. You + * may also pass in only a substring of the item from pango_itemize(). * * It is recommended that you use pango_shape_full() instead, since * that API allows for shaping interaction happening across text item * boundaries. + * + * Note that the extra attributes in the @analyis that is returned from + * pango_itemize() have indices that are relative to the entire paragraph, + * so you need to subtract the item offset from their indices before + * calling pango_shape(). */ void pango_shape (const gchar *text, @@ -83,6 +87,11 @@ pango_shape (const gchar *text, * text of which @item_text is part of, provide the broader text as * @paragraph_text. If @paragraph_text is %NULL, item text is used instead. * + * Note that the extra attributes in the @analyis that is returned from + * pango_itemize() have indices that are relative to the entire paragraph, + * so you do not pass the full paragraph text as @paragraph_text, you need + * to subtract the item offset from their indices before calling pango_shape_full(). + * * Since: 1.32 */ void @@ -170,6 +179,12 @@ fallback_shape (const char *text, * This is similar to pango_shape_full(), except it also takes * flags that can influence the shaping process. * + * Note that the extra attributes in the @analyis that is returned from + * pango_itemize() have indices that are relative to the entire paragraph, + * so you do not pass the full paragraph text as @paragraph_text, you need + * to subtract the item offset from their indices before calling + * pango_shape_with_flags(). + * * Since: 1.44 */ void diff --git a/subprojects/freetype2.wrap b/subprojects/freetype2.wrap index 21ed35ce..7c88f89c 100644 --- a/subprojects/freetype2.wrap +++ b/subprojects/freetype2.wrap @@ -1,12 +1,6 @@ -[wrap-file] -directory = freetype-2.9.1 - -source_url = https://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.gz -source_filename = freetype-2.9.1.tar.gz -source_hash = ec391504e55498adceb30baceebd147a6e963f636eb617424bcfc47a169898ce - -patch_url = https://wrapdb.mesonbuild.com/v1/projects/freetype2/2.9.1/1/get_zip -patch_filename = freetype2-2.9.1-1-wrap.zip -patch_hash = 06222607775e707c6d7b8d21ffdb04c7672f676a18c5ebb9880545130ab0407b - +[wrap-git] +directory=freetype2 +url=https://github.com/centricular/freetype2.git depth=1 +push-url=git@github.com:centricular/freetype2.git +revision=meson diff --git a/tests/gen-all-unicode.py b/tests/gen-all-unicode.py index 011ab9d2..c30cfc49 100644 --- a/tests/gen-all-unicode.py +++ b/tests/gen-all-unicode.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import sys # From glib/gutf8.c: diff --git a/tests/gen-installed-test.py b/tests/gen-installed-test.py index 794ea107..eeb4abee 100644 --- a/tests/gen-installed-test.py +++ b/tests/gen-installed-test.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import sys import argparse import os diff --git a/tests/meson.build b/tests/meson.build index 6e10e2b7..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() @@ -141,14 +140,13 @@ if get_option('install-tests') install_data(installed_test_items_data, install_dir: join_paths(installed_test_bindir, 'itemize')) endif -python = import('python3').find_python() gen_installed_test = files([ 'gen-installed-test.py' ]) gen_all_unicode = files([ 'gen-all-unicode.py' ]) custom_target('all-unicode', output: 'all-unicode.txt', command: [ - python, gen_all_unicode, '@OUTPUT@' + gen_all_unicode, '@OUTPUT@' ], install: get_option('install-tests'), install_dir: installed_test_bindir) @@ -161,7 +159,7 @@ foreach t: tests custom_target(name + '.test', output: name + '.test', command: [ - python, gen_installed_test, + gen_installed_test, installed_test_bindir, name, '@OUTDIR@', diff --git a/tests/test-shape.c b/tests/test-shape.c index c2488dbf..043f3d31 100644 --- a/tests/test-shape.c +++ b/tests/test-shape.c @@ -185,8 +185,6 @@ test_file (const gchar *filename, GString *string) pango_attr_list_unref (itemize_attrs); pango_attr_list_unref (shape_attrs); - pango_attr_list_unref (attrs); - for (l = items; l; l = l->next) { PangoItem *item = l->data; @@ -232,7 +230,7 @@ test_file (const gchar *filename, GString *string) if (i + 1 < glyphs->num_glyphs) p1 = text + item->offset + glyphs->log_clusters[i + 1]; else - p1 = g_utf8_next_char (p); + p1 = text + item->offset + item->length; } append_text (s1, p, p1 - p); g_string_append_printf (s2, "[%d]", gi->glyph); @@ -281,6 +279,8 @@ test_file (const gchar *filename, GString *string) g_list_free_full (items, (GDestroyNotify)pango_item_free); g_free (contents); g_free (text); + + pango_attr_list_unref (attrs); } static gchar * |