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: Tue, 23 Mar 2021 22:49:30 +0100	[thread overview]
Message-ID: <20210323214930.9l082SihTXGRIJ-rU3pwIRx-AY7tXxvyQPDNSiPqTao@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: 2794 bytes --]

From 9d49c635fed3533d54fcd31742fa86db16db8a42 Mon Sep 17 00:00:00 2001
From: andry-dev <andry-dev@users.noreply.github.com>
Date: Tue, 23 Mar 2021 22:45:50 +0100
Subject: [PATCH 1/2] freetype: move ClearType patch to a build option

---
 .../freetype/patches/enable-subpixel-rendering.patch  | 11 -----------
 srcpkgs/freetype/template                             |  6 ++++++
 2 files changed, 6 insertions(+), 11 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 5cba955ca2cf..000000000000
--- 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 ba4c6ad900c4..f327fcab8466 100644
--- a/srcpkgs/freetype/template
+++ b/srcpkgs/freetype/template
@@ -12,9 +12,15 @@ license="GPL-2.0-or-later, FTL"
 homepage="https://www.freetype.org/"
 distfiles="${NONGNU_SITE}/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=86a854d8905b19698bbc8f23b860bc104246ce4854dcea8e3b0fb21284f75784
+build_options="cleartype"
+desc_option_cleartype="Enable subpixel rendering similar to ClearType"
+build_options_default="cleartype"
 
 post_patch() {
 	vsed -i -e "s/%PKG_CONFIG%/pkg-config/" builds/unix/freetype-config.in
+	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() {

From 4df21cf586c5742c194f5a588e8e3677b75899d6 Mon Sep 17 00:00:00 2001
From: andry-dev <andry-dev@users.noreply.github.com>
Date: Tue, 23 Mar 2021 22:42:51 +0100
Subject: [PATCH 2/2] fontconfig: set lcdfilter by default

---
 srcpkgs/fontconfig/INSTALL | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/srcpkgs/fontconfig/INSTALL b/srcpkgs/fontconfig/INSTALL
index 1daa9b2a8f57..bf97a39b732a 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."

  parent reply	other threads:[~2021-03-23 21:49 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 ` [PR PATCH] [Updated] " andry-dev
2021-03-23 15:57 ` prez
2021-03-23 21:46 ` [PR PATCH] [Updated] " andry-dev
2021-03-23 21:49 ` andry-dev [this message]
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=20210323214930.9l082SihTXGRIJ-rU3pwIRx-AY7tXxvyQPDNSiPqTao@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).