summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2022-11-28 17:40:43 +0900
committerAkira TAGOH <akira@tagoh.org>2022-11-28 17:40:43 +0900
commit030759b74f5b3ce7fab6d17bbda6377444e82841 (patch)
tree1d5582d25b741e9e63fbc781dfb4d38289c1367a
parent6715a14f138df01c11110488b7edbf514e4076b4 (diff)
downloadfontconfig-030759b74f5b3ce7fab6d17bbda6377444e82841.tar.gz
Add --with-default-sub-pixel-rendering option
To make a choice of 10-sub-pixel-*.conf configurable. Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/337
-rw-r--r--conf.d/10-sub-pixel-none.conf (renamed from conf.d/10-no-sub-pixel.conf)0
-rw-r--r--conf.d/Makefile.am12
-rw-r--r--conf.d/meson.build5
-rw-r--r--configure.ac31
-rw-r--r--meson_options.txt3
5 files changed, 37 insertions, 14 deletions
diff --git a/conf.d/10-no-sub-pixel.conf b/conf.d/10-sub-pixel-none.conf
index 1fb6c98..1fb6c98 100644
--- a/conf.d/10-no-sub-pixel.conf
+++ b/conf.d/10-sub-pixel-none.conf
diff --git a/conf.d/Makefile.am b/conf.d/Makefile.am
index aefa783..fc26ef3 100644
--- a/conf.d/Makefile.am
+++ b/conf.d/Makefile.am
@@ -1,8 +1,8 @@
-#
+#
# fontconfig/conf.d/Makefile.am
-#
+#
# Copyright © 2005 Keith Packard
-#
+#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@@ -12,7 +12,7 @@
# specific, written prior permission. The authors make no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
-#
+#
# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@@ -33,7 +33,7 @@ CONF_LINKS = \
10-hinting-$(PREFERRED_HINTING).conf \
10-scale-bitmap-fonts.conf \
10-yes-antialias.conf \
- 10-sub-pixel-rgb.conf \
+ 10-sub-pixel-$(PREFERRED_SUB_PIXEL_RENDERING).conf \
11-lcdfilter-default.conf \
20-unhint-small-vera.conf \
30-metric-aliases.conf \
@@ -68,9 +68,9 @@ template_DATA = \
10-hinting-none.conf \
10-hinting-slight.conf \
10-no-antialias.conf \
- 10-no-sub-pixel.conf \
10-scale-bitmap-fonts.conf \
10-sub-pixel-bgr.conf \
+ 10-sub-pixel-none.conf \
10-sub-pixel-rgb.conf \
10-sub-pixel-vbgr.conf \
10-sub-pixel-vrgb.conf \
diff --git a/conf.d/meson.build b/conf.d/meson.build
index f8f1c9c..cc4e16c 100644
--- a/conf.d/meson.build
+++ b/conf.d/meson.build
@@ -7,9 +7,9 @@ conf_files = [
'10-hinting-none.conf',
'10-hinting-slight.conf',
'10-no-antialias.conf',
- '10-no-sub-pixel.conf',
'10-scale-bitmap-fonts.conf',
'10-sub-pixel-bgr.conf',
+ '10-sub-pixel-none.conf',
'10-sub-pixel-rgb.conf',
'10-sub-pixel-vbgr.conf',
'10-sub-pixel-vrgb.conf',
@@ -41,12 +41,13 @@ conf_files = [
]
preferred_hinting = get_option('default-hinting')
+preferred_sub_pixel_rendering = get_option('default-sub-pixel-rendering')
conf_links = [
'10-hinting-@0@.conf'.format(preferred_hinting),
'10-scale-bitmap-fonts.conf',
+ '10-sub-pixel-@0@.conf'.format(preferred_sub_pixel_rendering),
'10-yes-antialias.conf',
- '10-sub-pixel-rgb.conf',
'11-lcdfilter-default.conf',
'20-unhint-small-vera.conf',
'30-metric-aliases.conf',
diff --git a/configure.ac b/configure.ac
index 60871dc..b3e98a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
-dnl
+dnl
dnl fontconfig/configure.in
-dnl
+dnl
dnl Copyright © 2003 Keith Packard
-dnl
+dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
dnl documentation for any purpose is hereby granted without fee, provided that
dnl the above copyright notice appear in all copies and that both that
@@ -12,7 +12,7 @@ dnl advertising or publicity pertaining to distribution of the software without
dnl specific, written prior permission. The authors make no
dnl representations about the suitability of this software for any purpose. It
dnl is provided "as is" without express or implied warranty.
-dnl
+dnl
dnl THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@@ -26,7 +26,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ(2.61)
dnl ==========================================================================
-dnl Versioning
+dnl Versioning
dnl ==========================================================================
dnl This is the package version number, not the shared library
@@ -456,6 +456,25 @@ AC_SUBST(JSONC_CFLAGS)
AC_SUBST(JSONC_LIBS)
#
+# Set default sub-pixel rendering
+#
+
+AC_ARG_WITH(default-sub-pixel-rendering,
+ [AC_HELP_STRING([--with-default-sub-pixel-rendering=NAME],
+ [Enable your preferred sub-pixel rendering configuration (none/bgr/rgb/vbgr/vrgb) [default=none]])],
+ preferred_sub_pixel_rendering="$withval", preferred_sub_pixel_rendering=none)
+
+case "$preferred_sub_pixel_rendering" in
+none|bgr|rgb|vbgr|vrgb)
+ PREFERRED_SUB_PIXEL_RENDERING="$preferred_sub_pixel_rendering"
+ AC_SUBST(PREFERRED_SUB_PIXEL_RENDERING)
+ ;;
+*)
+ AC_MSG_ERROR([Invalid sub-pixel rendering. please choose one of none, bgr, rgb, vbgr, or vrgb])
+ ;;
+esac
+
+#
# Set default hinting
#
@@ -562,7 +581,7 @@ case "$FC_ADD_FONTS" in
"")
;;
*)
- FC_FONTPATH=`echo $FC_ADD_FONTS |
+ FC_FONTPATH=`echo $FC_ADD_FONTS |
sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
;;
esac
diff --git a/meson_options.txt b/meson_options.txt
index 1a95241..43c8764 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,6 +18,9 @@ option('cache-build', type : 'feature', value : 'enabled',
option('default-hinting', type: 'combo', choices: ['none', 'slight', 'medium', 'full'], value: 'slight',
description: 'Preferred hinting configuration')
+option('default-sub-pixel-rendering', type: 'combo', choices: ['none', 'bgr', 'rgb', 'vbgr', 'vrgb'], value: 'none',
+ description: 'Preferred sub-pixel rendering 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)')