Allow multiple default system font directories in the fallback config, and set them to the default dirs on Darwin.

This commit is contained in:
Niklas Guertler 2020-09-15 17:12:53 +02:00 committed by Akira TAGOH
parent 3fa85f033d
commit bc84228a2e
4 changed files with 41 additions and 21 deletions

View File

@ -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)

View File

@ -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 -->

View File

@ -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)

View File

@ -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>" \