[Fontconfig] fontconfig: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 3 13:38:01 UTC 2021


 configure.ac  |   30 ++++++++++++------------------
 fonts.conf.in |    2 +-
 meson.build   |   20 ++++++++++++++------
 3 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit d263d4075ea90f7a296c4d65e69eea504906689e
Author: Akira TAGOH <akira at tagoh.org>
Date:   Wed Mar 3 21:26:47 2021 +0900

    Refactoring configure.ac to add <dir> element around font paths

diff --git a/configure.ac b/configure.ac
index faee5b0..574be2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -486,30 +486,24 @@ AC_ARG_WITH(default-fonts,
 case "$default_fonts" in
 yes)
 	if test "$os_win32" = "yes"; then
-		FC_DEFAULT_FONTS_IN="WINDOWSFONTDIR"
+		default_fonts="WINDOWSFONTDIR"
 	elif test "$os_darwin" = "yes"; then
-		FC_DEFAULT_FONTS_IN="/System/Library/Fonts,/Library/Fonts,~/Library/Fonts,/System/Library/Assets/com_apple_MobileAsset_Font3,/System/Library/Assets/com_apple_MobileAsset_Font4"
+		default_fonts="/System/Library/Fonts,/Library/Fonts,~/Library/Fonts,/System/Library/Assets/com_apple_MobileAsset_Font3,/System/Library/Assets/com_apple_MobileAsset_Font4"
 	else
-		FC_DEFAULT_FONTS_IN="/usr/share/fonts"
+		default_fonts="/usr/share/fonts"
 	fi
 	;;
-*)
-	FC_DEFAULT_FONTS_IN="$default_fonts"
-	;;
-esac
-			   
-AC_SUBST(FC_DEFAULT_FONTS_IN)
-
-case "$FC_DEFAULT_FONTS_IN" in
-"")
-	FC_DEFAULT_FONTS=""
-	;;
-*)
-	FC_DEFAULT_FONTS=`echo $FC_DEFAULT_FONTS_IN | 
-			sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
-	;;
 esac
 
+FC_DEFAULT_FONTS=""
+if test x${default_fonts+set} = xset; then
+	fc_IFS=$IFS
+	IFS=","
+	for p in "$default_fonts"; do
+		FC_DEFAULT_FONTS="$FC_DEFAULT_FONTS\t<dir>$p</dir>\n"
+	done
+	IFS=$fc_IFS
+fi
 
 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$FC_DEFAULT_FONTS",
 			   [System font directory])
commit 10c7390e358c5ad9192f35c7e5314230e75acc03
Author: Akira TAGOH <akira at tagoh.org>
Date:   Wed Mar 3 21:25:06 2021 +0900

    Fix missing <dir> element for WINDOWSFONTDIR in meson
    
    also refactoring logic around it to reduce the redundant
    
    Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/276

diff --git a/fonts.conf.in b/fonts.conf.in
index 734e722..c0a63b4 100644
--- a/fonts.conf.in
+++ b/fonts.conf.in
@@ -24,7 +24,7 @@
 
 <!-- Font directory list -->
 
-	@FC_DEFAULT_FONTS@
+ at FC_DEFAULT_FONTS@
 	@FC_FONTPATH@
 	<dir prefix="xdg">fonts</dir>
 	<!-- the following element will be removed in the future -->
diff --git a/meson.build b/meson.build
index dac1761..4f84ca5 100644
--- a/meson.build
+++ b/meson.build
@@ -204,22 +204,30 @@ prefix = get_option('prefix')
 fonts_conf = configuration_data()
 
 if host_machine.system() == 'windows'
-  conf.set_quoted('FC_DEFAULT_FONTS', 'WINDOWSFONTDIR')
-  fonts_conf.set('FC_DEFAULT_FONTS', 'WINDOWSFONTDIR')
+  fc_fonts_path = ['WINDOWSFONTDIR']
   fc_cachedir = 'LOCAL_APPDATA_FONTCONFIG_CACHE'
 else
   if host_machine.system() == 'darwin'
-    conf.set_quoted('FC_DEFAULT_FONTS', '<dir>/System/Library/Fonts</dir> <dir>/Library/Fonts</dir> <dir>~/Library/Fonts</dir> <dir>/System/Library/Assets/com_apple_MobileAsset_Font3</dir> <dir>/System/Library/Assets/com_apple_MobileAsset_Font4</dir>')
-    fonts_conf.set('FC_DEFAULT_FONTS', '<dir>/System/Library/Fonts</dir> <dir>/Library/Fonts</dir> <dir>~/Library/Fonts</dir> <dir>/System/Library/Assets/com_apple_MobileAsset_Font3</dir> <dir>/System/Library/Assets/com_apple_MobileAsset_Font4</dir>')
+    fc_fonts_path = ['/System/Library/Fonts', '/Library/Fonts', '~/Library/Fonts', '/System/Library/Assets/com_apple_MobileAsset_Font3', '/System/Library/Assets/com_apple_MobileAsset_Font4']
   else
-    conf.set_quoted('FC_DEFAULT_FONTS', '<dir>/usr/share/fonts</dir>')
-    fonts_conf.set('FC_DEFAULT_FONTS', '<dir>/usr/share/fonts</dir>')
+    fc_fonts_path = ['/usr/share/fonts', '/usr/local/share/fonts']
   endif
   fc_cachedir = join_paths(prefix, get_option('localstatedir'), 'cache', meson.project_name())
   thread_dep = dependency('threads')
   conf.set('HAVE_PTHREAD', 1)
   deps += [thread_dep]
 endif
+xml_path = ''
+escaped_xml_path = ''
+foreach p : fc_fonts_path
+  s = '\t<dir>' + p + '</dir>\n'
+  xml_path += s
+  # No substitution method for string
+  s = '\\t<dir>' + p + '</dir>\\n'
+  escaped_xml_path += s
+endforeach
+conf.set_quoted('FC_DEFAULT_FONTS', escaped_xml_path)
+fonts_conf.set('FC_DEFAULT_FONTS', xml_path)
 
 fc_templatedir = join_paths(prefix, get_option('datadir'), 'fontconfig/conf.avail')
 fc_baseconfigdir = join_paths(prefix, get_option('sysconfdir'), 'fonts')


More information about the Fontconfig mailing list