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
This commit is contained in:
Akira TAGOH 2022-11-28 17:40:43 +09:00
parent 6715a14f13
commit 030759b74f
5 changed files with 37 additions and 14 deletions

View File

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

View File

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

View File

@ -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
@ -455,6 +455,25 @@ AM_CONDITIONAL(ENABLE_JSONC, test "x$use_jsonc" = "xyes")
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

View File

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