From 524f8b6df7a3a6b475adf354e227d377f2f64961 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sun, 30 Apr 2017 22:13:33 +0200 Subject: Add boot-time tweak 'nsh' to disable new sub-pixel hinting in freetype Freetype has enabled a 'new style' of sub-pixel hinting, based on the Infinality patch but simplified for speed. Some people feel that this new type of hinting is resulting in worse font rendering than with the old auto-hinter built into Freetype. The new tweak 'nsh' effectively disables the new type of sub-pixel hinting and makes Freetype fall back to the old behaviour. Usage: add "tweaks=nsh" to the boot commandline of the Live OS. --- liveinit.tpl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'liveinit.tpl') diff --git a/liveinit.tpl b/liveinit.tpl index de23e24..e20eb61 100755 --- a/liveinit.tpl +++ b/liveinit.tpl @@ -77,6 +77,12 @@ LOCALHD=0 # Usability tweaks: TWEAKS="" +# Deal with freetype's sub-pixel hinting. +# Enable the new v40 interpreter only if /etc/profile.d/freetype.sh is found. +# Otherwise (or in case 'tweaks=nsh' is passed at boot) disable the new +# interpreter and fall back to the old v35 interpreter. +SPH=1 + # Perhaps we need to blacklist some kernel module(s): BLACKLIST="" @@ -209,6 +215,7 @@ for ARG in $(cat /proc/cmdline); do tweaks=*) # Comma-separated set of usability tweaks. # nga: no glamor 2d acceleration. + # nsh: no sub-pixel hinting in freetype. # tpb: trackpoint scrolling while pressing middle mouse button. # syn: start synaptics daemon and extend X.Org capabilities. # ssh: start SSH daemon (disabled by default). @@ -992,6 +999,8 @@ Section "Device" Option "AccelMethod" "none" EndSection EOT + elif [ "$TWEAK" = "nsh" ]; then + SPH=0 elif [ "$TWEAK" = "tpb" ]; then # Enable scrolling with TrackPoint while pressing the middle mouse button. # Note: if this does not work for your TrackPoint, @@ -1049,6 +1058,45 @@ EOT fi done # End Tweaks. + # After parsing the tweaks, we know what to do with freetype's rendering: + if [ ! -f /mnt/overlay/etc/profile.d/freetype.sh ]; then + # Old freetype - disable sub-pixel hinting: + SPH=0 + fi + if [ $SPH -eq 1 ]; then + # Enable the new v40 interpreter in freetype: + sed -e 's/^ *[^# ]/#&/' -i /mnt/overlay/etc/profile.d/freetype.sh + cat <> /mnt/overlay/etc/profile.d/freetype.sh +export FREETYPE_PROPERTIES="truetype:interpreter-version=40" +EOT + sed -e 's/^ *[^# ]/#&/' -i /mnt/overlay/etc/profile.d/freetype.csh + cat <> /mnt/overlay/etc/profile.d/freetype.csh +setenv FREETYPE_PROPERTIES "truetype:interpreter-version=40" +EOT + # Adapt the font configuration: + ln -s /etc/fonts/conf.avail/10-hinting-slight.conf /mnt/overlay/etc/fonts/conf.d/ + ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf /mnt/overlay/etc/fonts/conf.d/ + cat < /mnt/overlay/home/${LIVEUID}/.Xresources +Xft.dpi: 96 +Xft.antialias: 1 +Xft.hinting: 1 +Xft.hintstyle: hintslight +Xft.lcdfilter: lcddefault +Xft.rgba: rgb +Xft.autohint: 0 +EOT + elif [ -f /mnt/overlay/etc/profile.d/freetype.sh ]; then + # Explicitly configure the non-default old v35 interpreter in freetype: + sed -e 's/^ *[^# ]/#&/' -i /mnt/overlay/etc/profile.d/freetype.sh + cat <> /mnt/overlay/etc/profile.d/freetype.sh +export FREETYPE_PROPERTIES="truetype:interpreter-version=35" +EOT + sed -e 's/^ *[^# ]/#&/' -i /mnt/overlay/etc/profile.d/freetype.csh + cat <> /mnt/overlay/etc/profile.d/freetype.csh +setenv FREETYPE_PROPERTIES "truetype:interpreter-version=35" +EOT + fi # End Sub-Pixel Hinting + # Blacklist kernel modules if requested: if [ ! -z "$BLACKLIST" ]; then mkdir -p /mnt/overlay/etc/modprobe.d -- cgit v1.2.3