summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Guertler <profclonk@gmail.com>2020-09-15 17:12:53 +0200
committerAkira TAGOH <akira@tagoh.org>2020-11-28 01:16:36 +0000
commitbc84228a2e00b7ef4d7641fcfd0c08340828819b (patch)
tree406697cb31fee350782c9fe03f983a536e32fffe
parent3fa85f033decbe98d9f654f622a356f73f2a8e14 (diff)
downloadfontconfig-bc84228a2e00b7ef4d7641fcfd0c08340828819b.tar.gz
Allow multiple default system font directories in the fallback config, and set them to the default dirs on Darwin.
-rw-r--r--configure.ac49
-rw-r--r--fonts.conf.in2
-rw-r--r--meson.build9
-rw-r--r--src/fcinit.c2
4 files changed, 41 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index f3189a7..de6d810 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,14 +89,17 @@ PKGCONFIG_REQUIRES=
PKGCONFIG_REQUIRES_PRIVATELY=
dnl ==========================================================================
-case "$host" in
- *-*-mingw*)
- os_win32=yes
- ;;
- *)
- os_win32=no
+AC_CANONICAL_HOST
+case "${host_os}" in
+ cygwin*|mingw*)
+ os_win32=yes
+ ;;
+ darwin*)
+ os_darwin=yes
+ ;;
esac
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
+AM_CONDITIONAL(OS_DARWIN, test "$os_darwin" = "yes")
dnl ==========================================================================
dnl gettext stuff
@@ -474,28 +477,40 @@ esac
#
AC_ARG_WITH(default-fonts,
- [AC_HELP_STRING([--with-default-fonts=DIR],
- [Use fonts from DIR when config is busted])],
+ [AC_HELP_STRING([--with-default-fonts=DIR1,DIR2,...],
+ [Use fonts from DIR1,DIR2,... when config is busted])],
default_fonts="$withval", default_fonts=yes)
case "$default_fonts" in
yes)
if test "$os_win32" = "yes"; then
- FC_DEFAULT_FONTS="WINDOWSFONTDIR"
- AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR",
- [Windows font directory])
+ FC_DEFAULT_FONTS_IN="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"
else
- FC_DEFAULT_FONTS="/usr/share/fonts"
- AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
- [System font directory])
+ FC_DEFAULT_FONTS_IN="/usr/share/fonts"
fi
;;
*)
- FC_DEFAULT_FONTS="$default_fonts"
- AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
- [System font directory])
+ 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
+
+
+AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$FC_DEFAULT_FONTS",
+ [System font directory])
AC_SUBST(FC_DEFAULT_FONTS)
diff --git a/fonts.conf.in b/fonts.conf.in
index e6561ae..734e722 100644
--- a/fonts.conf.in
+++ b/fonts.conf.in
@@ -24,7 +24,7 @@
<!-- Font directory list -->
- <dir>@FC_DEFAULT_FONTS@</dir>
+ @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 b066392..4b53495 100644
--- a/meson.build
+++ b/meson.build
@@ -208,8 +208,13 @@ if host_machine.system() == 'windows'
fonts_conf.set('FC_DEFAULT_FONTS', 'WINDOWSFONTDIR')
fc_cachedir = 'LOCAL_APPDATA_FONTCONFIG_CACHE'
else
- conf.set_quoted('FC_DEFAULT_FONTS', '/usr/share/fonts')
- fonts_conf.set('FC_DEFAULT_FONTS', '/usr/share/fonts')
+ 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>')
+ else
+ conf.set_quoted('FC_DEFAULT_FONTS', '/usr/share/fonts')
+ fonts_conf.set('FC_DEFAULT_FONTS', '/usr/share/fonts')
+ endif
fc_cachedir = join_paths(prefix, get_option('localstatedir'), 'cache', meson.project_name())
thread_dep = dependency('threads')
conf.set('HAVE_PTHREAD', 1)
diff --git a/src/fcinit.c b/src/fcinit.c
index 99df9b4..c05cdc5 100644
--- a/src/fcinit.c
+++ b/src/fcinit.c
@@ -41,7 +41,7 @@ FcInitFallbackConfig (const FcChar8 *sysroot)
FcConfig *config;
const FcChar8 *fallback = (const FcChar8 *) "" \
"<fontconfig>" \
- " <dir>" FC_DEFAULT_FONTS "</dir>" \
+ FC_DEFAULT_FONTS \
" <dir prefix=\"xdg\">fonts</dir>" \
" <cachedir>" FC_CACHEDIR "</cachedir>" \
" <cachedir prefix=\"xdg\">fontconfig</cachedir>" \