From 030759b74f5b3ce7fab6d17bbda6377444e82841 Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Mon, 28 Nov 2022 17:40:43 +0900 Subject: 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 --- conf.d/10-no-sub-pixel.conf | 15 --------------- conf.d/10-sub-pixel-none.conf | 15 +++++++++++++++ conf.d/Makefile.am | 12 ++++++------ conf.d/meson.build | 5 +++-- configure.ac | 31 +++++++++++++++++++++++++------ meson_options.txt | 3 +++ 6 files changed, 52 insertions(+), 29 deletions(-) delete mode 100644 conf.d/10-no-sub-pixel.conf create mode 100644 conf.d/10-sub-pixel-none.conf diff --git a/conf.d/10-no-sub-pixel.conf b/conf.d/10-no-sub-pixel.conf deleted file mode 100644 index 1fb6c98..0000000 --- a/conf.d/10-no-sub-pixel.conf +++ /dev/null @@ -1,15 +0,0 @@ - - - - Disable sub-pixel rendering - - - - none - - diff --git a/conf.d/10-sub-pixel-none.conf b/conf.d/10-sub-pixel-none.conf new file mode 100644 index 0000000..1fb6c98 --- /dev/null +++ b/conf.d/10-sub-pixel-none.conf @@ -0,0 +1,15 @@ + + + + Disable sub-pixel rendering + + + + none + + 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 @@ -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/^//' -e 's/$/<\/dir>/' -e 's/,/<\/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)') -- cgit v1.2.1