GNU bug report logs - #79090
Respects Fontconfig settings for ftcr and ftcrhb font backends

Previous Next

Package: emacs;

Reported by: Mike <mikeandmore <at> gmail.com>

Date: Fri, 25 Jul 2025 06:16:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 79090 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79090; Package emacs. (Fri, 25 Jul 2025 06:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mike <mikeandmore <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 25 Jul 2025 06:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mike <mikeandmore <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Respects Fontconfig settings for ftcr and ftcrhb font backends
Date: Thu, 24 Jul 2025 21:12:36 -0400
[Message part 1 (text/plain, inline)]
Tags: patch

The ftcr and ftcrhb backends use cairo to render fonts, but cairo does
not respect font specific fontconfig settings. This patch queries
fontconfig with the specific font, and then it translates the fontconfig
settings into cairo font settings.

Both backends would also ignore :hinting and :autohint properties from
the font-spec. This patch fixes that too.

In GNU Emacs 30.1 (build 1, x86_64-redhat-linux-gnu) of 2025-05-25 built
 on 02c108121fcd
System Description: Oracle Linux Server 9.4

Configured using:
 'configure --without-all --without-x --without-ns
 --with-compress-install --with-modules --with-sqlite3=yes
 --with-zlib=yes --with-threads=yes --with-modules=yes
 --with-file-notification=inotify
 --srcdir=/ports/editors/emacs30-nox11/work/emacs-30.1
 --localstatedir=/pkg/var --disable-autodepend --prefix=/pkg
 --build=x86_64-redhat-linux --host=x86_64-redhat-linux
 --infodir=/pkg/info --mandir=/pkg/man --enable-option-checking=yes
 'CFLAGS=-O2 -O3 -march=ivybridge -I/usr/include -I/pkg/include'
 'CPPFLAGS=-I/usr/include -I/pkg/include'
 'LDFLAGS=-L/pkg/gcc14/lib/gcc/x86_64-redhat-linux/14.2.0
 -Wl,-R/pkg/gcc14/lib/gcc/x86_64-redhat-linux/14.2.0 -L/pkg/gcc14/lib64
 -Wl,-R/pkg/gcc14/lib64 -L/usr/lib64 -Wl,-R/usr/lib64 -L/pkg/lib
 -Wl,-R/pkg/lib''

-- 
Thanks
Mike
[Message part 2 (text/html, inline)]
[emacs-fc-hinting.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79090; Package emacs. (Fri, 25 Jul 2025 07:35:02 GMT) Full text and rfc822 format available.

Message #8 received at 79090 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mike <mikeandmore <at> gmail.com>, Po Lu <luangruo <at> yahoo.com>
Cc: 79090 <at> debbugs.gnu.org
Subject: Re: bug#79090: Respects Fontconfig settings for ftcr and ftcrhb font
 backends
Date: Fri, 25 Jul 2025 10:34:03 +0300
> From: Mike <mikeandmore <at> gmail.com>
> Date: Thu, 24 Jul 2025 21:12:36 -0400
> 
> The ftcr and ftcrhb backends use cairo to render fonts, but cairo does
> not respect font specific fontconfig settings. This patch queries
> fontconfig with the specific font, and then it translates the fontconfig
> settings into cairo font settings.
> 
> Both backends would also ignore :hinting and :autohint properties from
> the font-spec. This patch fixes that too.

Thanks.

I don't use Fontconfig and Cairo, so someone else who does will need
to review the patch and try it.  Would you please post a procedure to
test this patch once applied?

Also, I wonder if this will have any user-level effects, and if so,
should we have a NEWS entry about that?

And finally, to accept changes of this size, we will need you to sign
a copyright-assignment agreement with FSF.  If you are willing to do
that, I will send you the form to fill and the instructions to go with
it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79090; Package emacs. (Wed, 30 Jul 2025 23:31:02 GMT) Full text and rfc822 format available.

Message #11 received at 79090 <at> debbugs.gnu.org (full text, mbox):

From: Mike <mikeandmore <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 79090 <at> debbugs.gnu.org
Subject: Re: bug#79090: Respects Fontconfig settings for ftcr and ftcrhb font
 backends
Date: Wed, 30 Jul 2025 19:30:17 -0400
[Message part 1 (text/plain, inline)]
Hi

Here's how I tested this.

1. I have the following base settings in fontconfig. They disable hinting
and autohint, so that Freetype will preserve the font shapes when rendering
web fonts.

  <match target="pattern">
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="globaladvance" mode="assign"><bool>true</bool></edit>
    <edit name="embeddedbitmap" mode="assign"><bool>false</bool></edit>
    <edit name="hinting" mode="assign"><bool>false</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintnone</const></edit>
    <edit name="rgba" mode="assign"><const>rgb</const></edit>
    <edit name="autohint" mode="assign"><bool>false</bool></edit>
    <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
  </match>

2. Enable hinting for specific local fonts so that I can use them inside
Emacs with a smaller font size.

  <match target="font">
    <test name="family"><string>Hack</string></test>
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
  </match>

For this step, you can also enable hinting in font-spec under Emacs.

Here are the screenshots. They are taken on a HiDPI display, and I'm going
to retake them tomorrow at work where we have low DPI displays.

Thanks
Mike


On Fri, Jul 25, 2025 at 3:34 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Mike <mikeandmore <at> gmail.com>
> > Date: Thu, 24 Jul 2025 21:12:36 -0400
> >
> > The ftcr and ftcrhb backends use cairo to render fonts, but cairo does
> > not respect font specific fontconfig settings. This patch queries
> > fontconfig with the specific font, and then it translates the fontconfig
> > settings into cairo font settings.
> >
> > Both backends would also ignore :hinting and :autohint properties from
> > the font-spec. This patch fixes that too.
>
> Thanks.
>
> I don't use Fontconfig and Cairo, so someone else who does will need
> to review the patch and try it.  Would you please post a procedure to
> test this patch once applied?
>
> Also, I wonder if this will have any user-level effects, and if so,
> should we have a NEWS entry about that?
>
> And finally, to accept changes of this size, we will need you to sign
> a copyright-assignment agreement with FSF.  If you are willing to do
> that, I will send you the form to fill and the instructions to go with
> it.
>


-- 
Thanks
Mike
[Message part 2 (text/html, inline)]
[screenshot-20250730-183722.png (image/png, attachment)]
[screenshot-20250730-183731.png (image/png, attachment)]

This bug report was last modified 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.