diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index f153c22..8ea9665 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,17 @@ fontconfig-2.8.0.tar.gz /fontconfig-2.12.93.tar.bz2 /fontconfig-2.13.0.tar.bz2 /fontconfig-2.13.1.tar.bz2 +/fontconfig-2.13.91.tar.xz +/fontconfig-2.13.92.tar.xz +/fontconfig-2.13.93.tar.xz +/fontconfig-2.13.94.tar.xz +/fontconfig-2.13.95.tar.xz +/fontconfig-2.13.96.tar.xz +/fontconfig-2.14.0.tar.xz +/fontconfig-2.14.1.tar.xz +/fontconfig-2.14.2.tar.xz +/fontconfig-2.15.0.tar.xz +/fontconfig-2.16.0.tar.xz +/fontconfig-2.16.1.tar.xz +/fontconfig-2.16.2.tar.xz +/fontconfig-2.17.0.tar.xz diff --git a/FcStrBuildFilename.3 b/FcStrBuildFilename.3 deleted file mode 100644 index c16d1f9..0000000 --- a/FcStrBuildFilename.3 +++ /dev/null @@ -1,16 +0,0 @@ -.\" auto-generated by docbook2man-spec from docbook-utils package -.TH "FcStrBuildFilename" "3" "07 June 2019" "Fontconfig 2.13.1" "" -.SH NAME -FcStrBuildFilename \- Concatenate strings as a file path -.SH SYNOPSIS -.nf -\fB#include -.sp -FcChar8 * FcStrBuildFilename (const FcChar8 *\fIpath\fB, \&...\fI\fB); -.fi\fR -.SH "DESCRIPTION" -.PP -Creates a filename from the given elements of strings as file paths -and concatenate them with the appropriate file separator. -Arguments must be null-terminated. -This returns a newly-allocated memory which should be freed when no longer needed. diff --git a/fontconfig-disable-network-required-test.patch b/fontconfig-disable-network-required-test.patch new file mode 100644 index 0000000..e048b49 --- /dev/null +++ b/fontconfig-disable-network-required-test.patch @@ -0,0 +1,113 @@ +diff -pruN fontconfig-2.17.0.orig/test/meson.build fontconfig-2.17.0/test/meson.build +--- fontconfig-2.17.0.orig/test/meson.build 2025-06-27 12:12:04.000000000 +0900 ++++ fontconfig-2.17.0/test/meson.build 2025-06-27 14:41:08.843726446 +0900 +@@ -1,16 +1,16 @@ +-fetch_test_fonts = custom_target( +- 'fetch_test_fonts', +- output: 'testfonts', +- command: [ +- python3, +- join_paths(meson.project_source_root(), 'build-aux', 'fetch-testfonts.py'), +- '--target-dir', +- '@BUILD_ROOT@/testfonts', +- '--try-symlink', +- ], +- build_by_default: false, +- build_always_stale: true, +-) ++#fetch_test_fonts = custom_target( ++# 'fetch_test_fonts', ++# output: 'testfonts', ++# command: [ ++# python3, ++# join_paths(meson.project_source_root(), 'build-aux', 'fetch-testfonts.py'), ++# '--target-dir', ++# '@BUILD_ROOT@/testfonts', ++# '--try-symlink', ++# ], ++# build_by_default: false, ++# build_always_stale: true, ++#) + + tests = [ + ['test-bz89617.c', {'c_args': ['-DSRCDIR="@0@"'.format(meson.current_source_dir())]}], +@@ -33,7 +33,7 @@ if host_machine.system() != 'windows' + ] + tests_not_parallel += [ + # FIXME: this needs NotoSans-hinted.zip font downloaded and unpacked into test build directory! see run-test.sh +- ['test-crbug1004254.c', {'dependencies': dependency('threads')}], # for pthread ++ # ['test-crbug1004254.c', {'dependencies': dependency('threads')}], # for pthread + ['test-mt-fccfg.c', {'include_directories': include_directories('../src'), 'dependencies': dependency('threads')}], + ] + +@@ -74,10 +74,10 @@ foreach test_data : tests + tests_not_pa + endforeach + + +-if get_option('fontations').enabled() +- rust = import('rust') +- rust.test('fc_fontations_rust_tests', fc_fontations, link_with: [libfontconfig_internal], depends: fetch_test_fonts, env: ['builddir=@0@'.format(meson.project_build_root())],) +-endif ++#if get_option('fontations').enabled() ++# rust = import('rust') ++# rust.test('fc_fontations_rust_tests', fc_fontations, link_with: [libfontconfig_internal], depends: fetch_test_fonts, env: ['builddir=@0@'.format(meson.project_build_root())],) ++#endif + + fs = import('fs') + +@@ -92,14 +92,14 @@ if host_machine.system() != 'windows' + + test('run_test_sh', find_program('run-test.sh'), timeout: 600, env: ['srcdir=@0@'.format(meson.current_source_dir()), 'builddir=@0@'.format(meson.current_build_dir()), 'EXEEXT=@0@'.format(conf.get('EXEEXT')), 'VERBOSE=1']) + +- if pytest.found() +- test('pytest', pytest, args: ['--tap'], +- workdir: meson.current_source_dir(), +- env: ['builddir=@0@'.format(meson.project_build_root())], +- protocol: 'tap', +- timeout: 600, +- depends: fetch_test_fonts) +- endif ++# if pytest.found() ++# test('pytest', pytest, args: ['--tap'], ++# workdir: meson.current_source_dir(), ++# env: ['builddir=@0@'.format(meson.project_build_root())], ++# protocol: 'tap', ++# timeout: 600, ++# depends: fetch_test_fonts) ++# endif + endif + + if jsonc_dep.found() +diff -pruN fontconfig-2.17.0.orig/test/run-test.sh fontconfig-2.17.0/test/run-test.sh +--- fontconfig-2.17.0.orig/test/run-test.sh 2025-06-27 12:12:04.000000000 +0900 ++++ fontconfig-2.17.0/test/run-test.sh 2025-06-27 14:39:19.098581228 +0900 +@@ -521,18 +521,18 @@ rm -rf "$MYCACHEBASEDIR" "$MYCONFIG" "$B + + fi # if [ "x$EXEEXT" = "x" ] + +-if [ -x "$BUILDTESTDIR"/test-crbug1004254 ]; then +- dotest "MT-safe global config" +- prep +- curl -s -o "$FONTDIR"/noto.zip https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip +- (cd "$FONTDIR"; unzip noto.zip) +- if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then +- touch -m -t "$(fdate ${SOURCE_DATE_EPOCH})" "$FONTDIR" +- fi +- "$BUILDTESTDIR"/test-crbug1004254 +-else ++#if [ -x "$BUILDTESTDIR"/test-crbug1004254 ]; then ++# dotest "MT-safe global config" ++# prep ++# curl -s -o "$FONTDIR"/noto.zip https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip ++# (cd "$FONTDIR"; unzip noto.zip) ++# if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then ++# touch -m -t "$(fdate ${SOURCE_DATE_EPOCH})" "$FONTDIR" ++# fi ++# "$BUILDTESTDIR"/test-crbug1004254 ++#else + echo "No test-crbug1004254: skipped" +-fi ++#fi + + if [ "x$EXEEXT" = "x" ]; then + diff --git a/fontconfig-drop-lang-from-pkgkit-format.patch b/fontconfig-drop-lang-from-pkgkit-format.patch new file mode 100644 index 0000000..abece6d --- /dev/null +++ b/fontconfig-drop-lang-from-pkgkit-format.patch @@ -0,0 +1,12 @@ +diff -pruN fontconfig-2.16.1.orig/src/fcformat.c fontconfig-2.16.1/src/fcformat.c +--- fontconfig-2.16.1.orig/src/fcformat.c 2025-03-13 20:16:47.000000000 +0900 ++++ fontconfig-2.16.1/src/fcformat.c 2025-03-13 20:42:03.633324643 +0900 +@@ -77,7 +77,7 @@ + #define FCCAT_FORMAT "\"%{file|basename|cescape}\" %{index} \"%{-file{%{=unparse|cescape}}}\"" + #define FCMATCH_FORMAT "%{file:-|basename}: \"%{family[0]:-}\" \"%{style[0]:-}\"" + #define FCLIST_FORMAT "%{?file{%{file}: }}%{-file{%{=unparse}}}" +-#define PKGKIT_FORMAT "%{[]family{font(%{family|downcase|delete( )})\n}}%{[]lang{font(:lang=%{lang|downcase|translate(_,-)})\n}}" ++#define PKGKIT_FORMAT "%{[]family{font(%{family|downcase|delete( )})\n}}" + + static void + message (const char *fmt, ...) diff --git a/fontconfig-fcvalidate.patch b/fontconfig-fcvalidate.patch deleted file mode 100644 index f0c8735..0000000 --- a/fontconfig-fcvalidate.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c336b8471877371f0190ba06f7547c54e2b890ba Mon Sep 17 00:00:00 2001 -From: Akira TAGOH -Date: Thu, 9 May 2019 07:10:11 +0000 -Subject: [PATCH 1/5] fc-validate: returns an error code when missing some - glyphs - -Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/154 ---- - fc-validate/fc-validate.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/fc-validate/fc-validate.c b/fc-validate/fc-validate.c -index 2ceee20..327ae63 100644 ---- a/fc-validate/fc-validate.c -+++ b/fc-validate/fc-validate.c -@@ -197,6 +197,7 @@ main (int argc, char **argv) - { - FcChar32 ucs4, pos, map[FC_CHARSET_MAP_SIZE]; - -+ err = 1; - printf (_("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n"), - argv[i], index, count, lang); - --- -2.22.0.rc3 - diff --git a/fontconfig-fix-crash.patch b/fontconfig-fix-crash.patch new file mode 100644 index 0000000..c52b33d --- /dev/null +++ b/fontconfig-fix-crash.patch @@ -0,0 +1,28 @@ +From b9bec06d73340f1b5727302d13ac3df307b7febc Mon Sep 17 00:00:00 2001 +From: Akira TAGOH +Date: Mon, 30 Jun 2025 09:05:18 +0900 +Subject: [PATCH] Fix a heap buffer overflow + +https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/481 + +Changelog: fixed +--- + src/fcfreetype.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/fcfreetype.c b/src/fcfreetype.c +index 7a4d9811..0a87d27a 100644 +--- a/src/fcfreetype.c ++++ b/src/fcfreetype.c +@@ -2661,7 +2661,7 @@ FcFontCapabilities (FT_Face face) + goto bail; + + maxsize = (((FT_ULong)gpos_count + (FT_ULong)gsub_count) * OTLAYOUT_LEN + +- (issilgraphitefont ? strlen(fcSilfCapability) : 0)); ++ (issilgraphitefont ? strlen(fcSilfCapability) + 1: 0)); + complex_ = malloc (sizeof (FcChar8) * maxsize); + if (!complex_) + goto bail; +-- +2.50.0 + diff --git a/fontconfig-flatpak.patch b/fontconfig-flatpak.patch deleted file mode 100644 index 0f49b71..0000000 --- a/fontconfig-flatpak.patch +++ /dev/null @@ -1,3009 +0,0 @@ -From 12aebf728fec7b3cc7c203b27f2cf8fd203f81c6 Mon Sep 17 00:00:00 2001 -From: Akira TAGOH -Date: Fri, 12 Apr 2019 12:03:57 +0000 -Subject: [PATCH 1/6] Rework Flatpak support - -fontconfig relies on font paths to determine cache filename -and it is used to generate MD5. this means fontconfig -re-generates caches even if it has same fonts. -This affects the performance a lot on Flatpak applications -because they share fonts from host with different -paths and then re-generating caches at first run. - -So we put an UUID into .uuid at a font directory as -an unique identifier, and generate caches with it instead -of MD5. However, this affects the reproducible builds now -because UUID is randomly generated and it is impossible to predict. - -So reverting it and introduce new mechanism to share caches. - -fontconfig now has remap-dir element to handle a font -path as a different path internally. let's see: - -/run/host/fonts - -When accessing a cache from host, fontconfig considers it is -a cache for /run/host/fonts and shows patterns to applications -like that. - -So what if having own fonts under /usr/share/fonts? -To address this, fontconfig extends dir element to give a salt -to allow generating different cache filename. - -/usr/share/fonts - -Then fontconfig generates a cache in the different name -to what host has. ---- - conf.d/05-reset-dirs-sample.conf | 9 + - conf.d/Makefile.am | 1 + - configure.ac | 33 ---- - doc/fccache.fncs | 5 +- - doc/fcstring.fncs | 12 ++ - doc/fontconfig-user.sgml | 21 +- - fc-cache/fc-cache.c | 12 +- - fontconfig/fontconfig.h | 4 + - fonts.dtd | 17 ++ - src/Makefile.am | 3 +- - src/fccache.c | 322 +++++++++++++------------------ - src/fccfg.c | 168 ++++++++++++---- - src/fcdir.c | 8 - - src/fchash.c | 20 -- - src/fcint.h | 39 +++- - src/fcstr.c | 166 ++++++++++++++++ - src/fcxml.c | 277 ++++++++++++++++++-------- - test/Makefile.am | 13 +- - test/fonts.conf.in | 1 + - test/run-test-conf.sh | 2 +- - test/run-test-map.sh | 107 ++++++++++ - test/run-test.sh | 197 ++++++++++++------- - test/test-bz106632.c | 85 ++++---- - test/test-conf.c | 1 + - test/test-hash.c | 187 ------------------ - test/test-issue107.c | 248 ++++++++++++++++++++++++ - 26 files changed, 1271 insertions(+), 687 deletions(-) - create mode 100644 conf.d/05-reset-dirs-sample.conf - create mode 100755 test/run-test-map.sh - delete mode 100644 test/test-hash.c - create mode 100644 test/test-issue107.c - -diff --git a/conf.d/05-reset-dirs-sample.conf b/conf.d/05-reset-dirs-sample.conf -new file mode 100644 -index 00000000..80bb6fb8 ---- /dev/null -+++ b/conf.d/05-reset-dirs-sample.conf -@@ -0,0 +1,9 @@ -+ -+ -+ -+ Re-define fonts dirs sample -+ -+ -+ fonts -+ -+ -diff --git a/conf.d/Makefile.am b/conf.d/Makefile.am -index ff03fb2e..d0f3f263 100644 ---- a/conf.d/Makefile.am -+++ b/conf.d/Makefile.am -@@ -52,6 +52,7 @@ config_DATA = $(DOC_FILES) - - templatedir = $(TEMPLATEDIR) - template_DATA = \ -+ 05-reset-dirs-sample.conf \ - 10-autohint.conf \ - 10-hinting-full.conf \ - 10-hinting-medium.conf \ -diff --git a/configure.ac b/configure.ac -index fb8af467..4a864f64 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -332,39 +332,6 @@ AM_CONDITIONAL(FREETYPE_PCF_LONG_FAMILY_NAMES, test "x$have_pcf_long_family_name - LIBS="$fontconfig_save_libs" - CFLAGS="$fontconfig_save_cflags" - --# --# Check for uuid --# --if test "$os_win32" != "yes"; then -- use_pkgconfig_for_uuid=yes -- if test -n "${UUID_LIBS}"; then -- save_UUID_LIBS=$UUID_LIBS -- fi -- PKG_CHECK_MODULES([UUID], [uuid], -- [use_pkgconfig_for_uuid=yes], -- [use_pkgconfig_for_uuid=no]) -- if test "x$use_pkgconfig_for_uuid" = "xno"; then -- AC_MSG_CHECKING([where uuid functions comes from]) -- AC_TRY_LINK([#include ], -- [uuid_t a; uuid_generate(a);], -- [AC_MSG_RESULT([builtin]) -- UUID_CFLAGS="" -- UUID_LIBS="" -- ],[AC_MSG_ERROR([ --*** uuid is required. install util-linux. -- ])]) -- else -- if test -z "${save_UUID_LIBS+x}" && test "x${UUID_LIBS}" != "x"; then -- PKGCONFIG_REQUIRES_PRIVATELY="$PKGCONFIG_REQUIRES_PRIVATELY uuid" -- fi -- fi --else -- UUID_CFLAGS="" -- UUID_LIBS="" --fi --AC_SUBST(UUID_CFLAGS) --AC_SUBST(UUID_LIBS) -- - # - # Check expat configuration - # -diff --git a/doc/fccache.fncs b/doc/fccache.fncs -index 972b6423..cf791349 100644 ---- a/doc/fccache.fncs -+++ b/doc/fccache.fncs -@@ -95,10 +95,7 @@ to config. - @TYPE3@ FcConfig * @ARG3@ config - @PURPOSE@ Create .uuid file at a directory - @DESC@ --This is to create .uuid file containing an UUID at a font directory of --dir. --The UUID will be used to identify the font directory and is used to determine --the cache filename if available. -+This function is deprecated. it doesn't take any effects. - @SINCE@ 2.12.92 - @@ - -diff --git a/doc/fcstring.fncs b/doc/fcstring.fncs -index 0412bbd1..d5ec043b 100644 ---- a/doc/fcstring.fncs -+++ b/doc/fcstring.fncs -@@ -223,6 +223,18 @@ This is just a wrapper around free(3) which helps track memory usage of - strings within the fontconfig library. - @@ - -+@RET@ FcChar8 * -+@FUNC@ FcStrBuildFilename -+@TYPE1@ const FcChar8 * @ARG1@ path -+@TYPE2@ ... -+@PURPOSE@ Concatenate strings as a file path -+@DESC@ -+Creates a filename from the given elements of strings as file paths -+and concatenate them with the appropriate file separator. -+Arguments must be null-terminated. -+This returns a newly-allocated memory which should be freed when no longer needed. -+@@ -+ - @RET@ FcChar8 * - @FUNC@ FcStrDirname - @TYPE1@ const FcChar8 * @ARG1@ file -diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml -index 89df86ef..9fbfe94a 100644 ---- a/doc/fontconfig-user.sgml -+++ b/doc/fontconfig-user.sgml -@@ -310,9 +310,13 @@ following structure: - This is the top level element for a font configuration and can contain - <dir>, <cachedir>, <include>, <match> and <alias> elements in any order. - -- <literal><dir prefix="default"></literal> -+ <literal><dir prefix="default" salt=""></literal> - This element contains a directory name which will be scanned for font files --to include in the set of available fonts. If 'prefix' is set to "xdg", the value in the XDG_DATA_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details. -+to include in the set of available fonts. -+ -+If 'prefix' is set to "xdg", the value in the XDG_DATA_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details. -+ -+'salt' property affects to determine cache filename. this is useful for example when having different fonts sets on same path at container and share fonts from host on different font path. - - <literal><cachedir prefix="default"></literal> - This element contains a directory name that is supposed to be stored or read -@@ -346,6 +350,19 @@ drawn as blanks on the screen. Within the <blank> elem - Unicode characters which is supposed to be blank in an <int> element. - Characters outside of this set which are drawn as blank will be elided from - the set of characters supported by the font. -+ -+ <literal><remap-dir prefix="default" as-path="" salt=""<</literal> -+This element contains a directory name where will be mapped -+as the path 'as-path' in cached information. -+This is useful if the directory name is an alias -+(via a bind mount or symlink) to another directory in the system for -+which cached font information is likely to exist. -+ -+'salt' property affects to determine cache filename as same as <dir> element. -+ -+ <literal><reset-dirs /></literal> -+This element removes all of fonts directories where added by <dir> elements. -+This is useful to override fonts directories from system to own fonts directories only. - - <literal><rescan></literal> - The <rescan> element holds an <int> element which indicates the default -diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c -index 87e30208..7c58f406 100644 ---- a/fc-cache/fc-cache.c -+++ b/fc-cache/fc-cache.c -@@ -191,7 +191,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, - if (really_force) - { - FcDirCacheUnlink (dir, config); -- FcDirCacheCreateUUID ((FcChar8 *) dir, FcTrue, config); - } - - cache = NULL; -@@ -392,6 +391,17 @@ main (int argc, char **argv) - return 1; - } - -+ if (verbose) -+ { -+ const FcChar8 *dir; -+ -+ printf ("Font directories:\n"); -+ while ((dir = FcStrListNext (list))) -+ { -+ printf ("\t%s\n", dir); -+ } -+ FcStrListFirst(list); -+ } - changed = 0; - ret = scanDirs (list, config, force, really_force, verbose, error_on_no_fonts, &changed); - FcStrListDone (list); -diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h -index bac1dda7..af870d0e 100644 ---- a/fontconfig/fontconfig.h -+++ b/fontconfig/fontconfig.h -@@ -1076,6 +1076,10 @@ FcUtf16Len (const FcChar8 *string, - int *nchar, - int *wchar); - -+FcPublic FcChar8 * -+FcStrBuildFilename (const FcChar8 *path, -+ ...); -+ - FcPublic FcChar8 * - FcStrDirname (const FcChar8 *file); - -diff --git a/fonts.dtd b/fonts.dtd -index 479f2c0f..fede9a79 100644 ---- a/fonts.dtd -+++ b/fonts.dtd -@@ -4,6 +4,8 @@ - cachedir | - include | - config | -+ remap-dir | -+ reset-dirs | - selectfont | - match | - alias)* > -@@ -94,6 +96,21 @@ - - - --> -+ -+ -+ -+ -+ -+ -+ -+ -