Github messages for voidlinux
 help / color / mirror / Atom feed
From: andry-dev <andry-dev@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] fontconfig: fix subpixel rendering in GTK applications
Date: Fri, 31 Jul 2020 10:17:28 +0200	[thread overview]
Message-ID: <20200731081728.Hl_mo7YyXy8sq9Vd8uG__iu_tSYeCRztELvwK4NVVFA@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23962@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]

There is an updated pull request by andry-dev against master on the void-packages repository

https://github.com/andry-dev/void-packages fontconfig
https://github.com/void-linux/void-packages/pull/23962

fontconfig: fix subpixel rendering in GTK applications
This PR hopefully closes #21429.

The first commit converts the freetype's ClearType patch to a build option; while it is not necessary for the fix, @ericonr suggested it and it seems helpful.

The second commit provides a `fontconfig` configuration file that sets `lcdfilter` to `lcddefault`, fixing the issue.
The config file provides a system-wide default without enforcing it, so the user/desktop environment can override the option in `~/.config/fontconfig/fonts.conf`. This doesn't break existing users: if they set the option anywhere then that is respected, if they didn't then subpixel rendering will work as intended.
Setting `lcdfilter` to `lcdlight` in `fonts.conf` is equivalent to the default "Harmony" engine, so it's the same as not having the patch in the first place.

## Why is this needed anyway?

A year ago I opened #13296, which enables ClearType in `freetype`. When testing it I had `lcdfilter` already set to `lcddefault` in my own `fonts.conf` and I didn't think about setting the option by default system-wide, so I never noticed any regression. Sorry for that.

I wrote the patch because without it I couldn't read text effortlessly, the font wasn't "right" for me. Major distros (Ubuntu, Debian and Fedora from the top of my head) have it enabled by default because, _generally speaking_, font rendering feels better with it.

A patch file from https://github.com/void-linux/void-packages/pull/23962.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-fontconfig-23962.patch --]
[-- Type: text/x-diff, Size: 3432 bytes --]

From 297a04f3dc33e655832a15dae6adf4000c64707d Mon Sep 17 00:00:00 2001
From: andry-dev <peketribal2@gmail.com>
Date: Thu, 30 Jul 2020 22:24:53 +0000
Subject: [PATCH 1/2] freetype: move ClearType patch to a build option

---
 .../freetype/patches/enable-subpixel-rendering.patch  | 11 -----------
 srcpkgs/freetype/template                             | 11 ++++++++++-
 2 files changed, 10 insertions(+), 12 deletions(-)
 delete mode 100644 srcpkgs/freetype/patches/enable-subpixel-rendering.patch

diff --git a/srcpkgs/freetype/patches/enable-subpixel-rendering.patch b/srcpkgs/freetype/patches/enable-subpixel-rendering.patch
deleted file mode 100644
index 5cba955ca2c..00000000000
--- a/srcpkgs/freetype/patches/enable-subpixel-rendering.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- include/freetype/config/ftoption.h
-+++ include/freetype/config/ftoption.h
-@@ -126,7 +126,7 @@
-    * macro is not defined, FreeType offers alternative LCD rendering
-    * technology that produces excellent output without LCD filtering.
-    */
--/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
-
-   /**************************************************************************
diff --git a/srcpkgs/freetype/template b/srcpkgs/freetype/template
index f279908c442..d3f072ff201 100644
--- a/srcpkgs/freetype/template
+++ b/srcpkgs/freetype/template
@@ -1,7 +1,7 @@
 # Template file for 'freetype'
 pkgname=freetype
 version=2.10.2
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--enable-freetype-config"
 hostmakedepends="pkg-config"
@@ -12,6 +12,15 @@ license="GPL-2.0-or-later, FTL"
 homepage="https://www.freetype.org/"
 distfiles="${NONGNU_SITE}/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=1543d61025d2e6312e0a1c563652555f17378a204a61e99928c9fcef030a2d8b
+build_options="cleartype"
+desc_option_cleartype="Enable subpixel rendering similar to ClearType"
+build_options_default="cleartype"
+
+post_patch() {
+	if [ "$build_option_cleartype" ]; then
+		vsed -i include/freetype/config/ftoption.h -e 's@/\* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING \*/@#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING@'
+	fi
+}
 
 post_install() {
 	vlicense docs/LICENSE.TXT docs/FTL.TXT

From 3e6a8e802de53b8bbd320ce3384dc4a88eab0e06 Mon Sep 17 00:00:00 2001
From: andry-dev <peketribal2@gmail.com>
Date: Thu, 30 Jul 2020 22:30:33 +0000
Subject: [PATCH 2/2] fontconfig: set lcdfilter by default

---
 srcpkgs/fontconfig/INSTALL  | 4 ++++
 srcpkgs/fontconfig/template | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/fontconfig/INSTALL b/srcpkgs/fontconfig/INSTALL
index 1daa9b2a8f5..bf97a39b732 100644
--- a/srcpkgs/fontconfig/INSTALL
+++ b/srcpkgs/fontconfig/INSTALL
@@ -5,6 +5,10 @@ case "${ACTION}" in
 pre)
 	;;
 post)
+	if [ "$UPDATE" = "no" ]; then
+		ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/
+	fi
+
 	echo "Building fonts cache... "
 	fc-cache -f >/dev/null
 	echo "done."
diff --git a/srcpkgs/fontconfig/template b/srcpkgs/fontconfig/template
index 18504e4503f..fca09c2c0ba 100644
--- a/srcpkgs/fontconfig/template
+++ b/srcpkgs/fontconfig/template
@@ -1,7 +1,7 @@
 # Template file for 'fontconfig'
 pkgname=fontconfig
 version=2.13.1
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--enable-static --enable-docs --with-cache-dir=/var/cache/${pkgname}"
 hostmakedepends="gperf pkg-config"

  parent reply	other threads:[~2020-07-31  8:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 21:59 [PR PATCH] " andry-dev
2020-07-30 23:34 ` [PR REVIEW] " ahesford
2020-07-30 23:34 ` ahesford
2020-07-30 23:34 ` ahesford
2020-07-30 23:34 ` ahesford
2020-07-30 23:34 ` ahesford
2020-07-30 23:34 ` ahesford
2020-07-30 23:34 ` ahesford
2020-07-31  0:05 ` ericonr
2020-07-31  0:06 ` ericonr
2020-07-31  0:15 ` ahesford
2020-07-31  8:17 ` andry-dev [this message]
2021-03-23 15:57 ` prez
2021-03-23 21:46 ` [PR PATCH] [Updated] " andry-dev
2021-03-23 21:49 ` andry-dev
2022-04-18  2:11 ` github-actions
2022-07-18  2:13 ` github-actions
2022-07-18 13:19 ` prez
2022-07-19 20:30 ` leahneukirchen
2022-07-20 19:01 ` the-maldridge
2022-07-20 19:01 ` [PR PATCH] [Closed]: " the-maldridge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200731081728.Hl_mo7YyXy8sq9Vd8uG__iu_tSYeCRztELvwK4NVVFA@z \
    --to=andry-dev@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).