summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2022-07-02 17:30:27 +0100
committerTim-Philipp Müller <tim@centricular.com>2022-07-02 19:01:03 +0100
commit0d8d75e5598a98385a7bf1d5f2c1c5753c83423a (patch)
treeded58540ab24802d7b366c7a494fe6ccec45239d
parent56a24879246b4e4ae3bbe496b3e6d0a4443a598d (diff)
downloadfontconfig-0d8d75e5598a98385a7bf1d5f2c1c5753c83423a.tar.gz
meson: add 'default-fonts-dirs' option
Fixes #244
-rw-r--r--meson.build34
-rw-r--r--meson_options.txt3
2 files changed, 24 insertions, 13 deletions
diff --git a/meson.build b/meson.build
index cf21eb1..42189d2 100644
--- a/meson.build
+++ b/meson.build
@@ -213,23 +213,21 @@ prefix = get_option('prefix')
fonts_conf = configuration_data()
-if host_machine.system() == 'windows'
- fc_fonts_path = ['WINDOWSFONTDIR', 'WINDOWSUSERFONTDIR']
- fc_cachedir = 'LOCAL_APPDATA_FONTCONFIG_CACHE'
-else
- if host_machine.system() == 'darwin'
- fc_fonts_path = ['/System/Library/Fonts', '/Library/Fonts', '~/Library/Fonts', '/System/Library/Assets/com_apple_MobileAsset_Font3', '/System/Library/Assets/com_apple_MobileAsset_Font4']
+default_fonts_dirs = get_option('default-fonts-dirs')
+if default_fonts_dirs == ['yes']
+ if host_machine.system() == 'windows'
+ fc_fonts_paths = ['WINDOWSFONTDIR', 'WINDOWSUSERFONTDIR']
+ elif host_machine.system() == 'darwin'
+ fc_fonts_paths = ['/System/Library/Fonts', '/Library/Fonts', '~/Library/Fonts', '/System/Library/Assets/com_apple_MobileAsset_Font3', '/System/Library/Assets/com_apple_MobileAsset_Font4']
else
- fc_fonts_path = ['/usr/share/fonts', '/usr/local/share/fonts']
+ fc_fonts_paths = ['/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]
+else
+ fc_fonts_paths = default_fonts_dirs
endif
xml_path = ''
escaped_xml_path = ''
-foreach p : fc_fonts_path
+foreach p : fc_fonts_paths
s = '\t<dir>' + p + '</dir>\n'
xml_path += s
# No substitution method for string
@@ -239,6 +237,15 @@ endforeach
conf.set_quoted('FC_DEFAULT_FONTS', escaped_xml_path)
fonts_conf.set('FC_DEFAULT_FONTS', xml_path)
+if host_machine.system() == 'windows'
+ fc_cachedir = 'LOCAL_APPDATA_FONTCONFIG_CACHE'
+else
+ 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
+
fc_templatedir = join_paths(prefix, get_option('datadir'), 'fontconfig/conf.avail')
fc_baseconfigdir = join_paths(prefix, get_option('sysconfdir'), 'fonts')
fc_configdir = join_paths(fc_baseconfigdir, 'conf.d')
@@ -396,5 +403,6 @@ summary({
'Tools': not get_option('tools').disabled(),
}, section: 'General', bool_yn: true, list_sep: ', ')
summary({
- 'Hinting': get_option('default-hinting'),
+ 'Hinting': preferred_hinting,
+ 'Font directories': fc_fonts_paths,
}, section: 'Defaults', bool_yn: true, list_sep: ', ')
diff --git a/meson_options.txt b/meson_options.txt
index 3cad85a..132f6c5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -17,3 +17,6 @@ option('cache-build', type : 'feature', value : 'enabled',
# Defaults
option('default-hinting', type: 'combo', choices: ['none', 'slight', 'medium', 'full'], value: 'slight',
description: 'Preferred hinting configuration')
+
+option('default-fonts-dirs', type: 'array', value: ['yes'],
+ description: 'Use fonts from DIR1,DIR2,... when config is busted (set to "yes" for generic system-specific defaults)')