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
This commit is contained in:
Akira TAGOH 2021-03-03 21:25:06 +09:00
parent 4e42925096
commit 10c7390e35
2 changed files with 15 additions and 7 deletions

View File

@ -204,22 +204,30 @@ prefix = get_option('prefix')
fonts_conf = configuration_data() fonts_conf = configuration_data()
if host_machine.system() == 'windows' if host_machine.system() == 'windows'
conf.set_quoted('FC_DEFAULT_FONTS', 'WINDOWSFONTDIR') fc_fonts_path = ['WINDOWSFONTDIR']
fonts_conf.set('FC_DEFAULT_FONTS', 'WINDOWSFONTDIR')
fc_cachedir = 'LOCAL_APPDATA_FONTCONFIG_CACHE' fc_cachedir = 'LOCAL_APPDATA_FONTCONFIG_CACHE'
else else
if host_machine.system() == 'darwin' 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>') fc_fonts_path = ['/System/Library/Fonts', '/Library/Fonts', '~/Library/Fonts', '/System/Library/Assets/com_apple_MobileAsset_Font3', '/System/Library/Assets/com_apple_MobileAsset_Font4']
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 else
conf.set_quoted('FC_DEFAULT_FONTS', '<dir>/usr/share/fonts</dir>') fc_fonts_path = ['/usr/share/fonts', '/usr/local/share/fonts']
fonts_conf.set('FC_DEFAULT_FONTS', '<dir>/usr/share/fonts</dir>')
endif endif
fc_cachedir = join_paths(prefix, get_option('localstatedir'), 'cache', meson.project_name()) fc_cachedir = join_paths(prefix, get_option('localstatedir'), 'cache', meson.project_name())
thread_dep = dependency('threads') thread_dep = dependency('threads')
conf.set('HAVE_PTHREAD', 1) conf.set('HAVE_PTHREAD', 1)
deps += [thread_dep] deps += [thread_dep]
endif 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_templatedir = join_paths(prefix, get_option('datadir'), 'fontconfig/conf.avail')
fc_baseconfigdir = join_paths(prefix, get_option('sysconfdir'), 'fonts') fc_baseconfigdir = join_paths(prefix, get_option('sysconfdir'), 'fonts')