GNU bug report logs - #17792
24.3; hintstyle specified via fontconfig is ignored by Emacs

Previous Next

Package: emacs;

Reported by: yynyygy <at> gmail.com

Date: Tue, 17 Jun 2014 03:10:02 UTC

Severity: normal

Found in version 24.3

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17792 in the body.
You can then email your comments to 17792 AT debbugs.gnu.org in the normal way.

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#17792; Package emacs. (Tue, 17 Jun 2014 03:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to yynyygy <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Jun 2014 03:10:03 GMT) Full text and rfc822 format available.

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

From: yynyygy <at> gmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; hintstyle specified via fontconfig is ignored by Emacs
Date: Tue, 17 Jun 2014 11:08:22 +0800
I've noticed font rendering differences between Emacs and other gtk
applications like gedit. In short, Emacs ignores hintstyle setting in
fontconfig. I have hintstyle set to hintslight in
~/.config/fontconfig/fonts.conf, but I have to add 'Xft.hintstyle:
hintslight' in Xresources to get the desired effect.

The strange thing is that while ignoring hintstyle setting, Emacs still
respect part of fontconfig settings, for example, anti-aliasing setting
in fonts.conf will affect Emacs's font rendering.

To be more precise, if I disable anti-aliasing in fonts.conf and enable
it in Xresources, Emacs will not have anti-aliasing; if I have
hintslight in fonts.conf and hintnone in Xresources, Emacs will use
hintnone.

I have tested with DejaVu Sans Mono 12 and Ubuntu Mono 13, but clearly
it is not the fonts' problem.


In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
 of 2014-06-11 on gentoo
Windowing system distributor `The X.Org Foundation', version 11.0.11500000
System Description:	NAME=Gentoo

Configured using:
 `configure '--prefix=/usr' '--build=x86_64-pc-linux-gnu'
 '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man'
 '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc'
 '--localstatedir=/var/lib' '--libdir=/usr/lib64'
 '--disable-silent-rules' '--disable-dependency-tracking'
 '--program-suffix=-emacs-24' '--infodir=/usr/share/info/emacs-24'
 '--localstatedir=/var'
 '--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64'
 '--with-gameuser=games' '--without-compress-info' '--without-hesiod'
 '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus'
 '--without-gnutls' '--without-xml2' '--without-selinux'
 '--without-wide-int' '--with-sound' '--with-x' '--without-ns'
 '--without-gconf' '--without-gsettings' '--without-toolkit-scroll-bars'
 '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
 '--with-xpm' '--without-imagemagick' '--with-xft' '--without-libotf'
 '--without-m17n-flt' '--with-x-toolkit=gtk3'
 'GENTOO_PACKAGE=app-editors/emacs-24.3-r6'
 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu'
 'CFLAGS=-march=native -O2 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'
 'CPPFLAGS=''

Important settings:
  value of $LC_COLLATE: C
  value of $LC_CTYPE: zh_CN.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r <tab> <return> C-y <backspace> <backspace> 
M-x M-p <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
current-kill: Kill ring is empty
delete-backward-char: Text is read-only [2 times]
Quit

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date china-util tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind dynamic-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17792; Package emacs. (Tue, 17 Jun 2014 15:29:01 GMT) Full text and rfc822 format available.

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

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: yynyygy <at> gmail.com
Cc: 17792 <at> debbugs.gnu.org
Subject: Re: bug#17792: 24.3;
 hintstyle specified via fontconfig is ignored by Emacs
Date: Tue, 17 Jun 2014 17:28:10 +0200
Hello.

17 jun 2014 kl. 05:08 skrev yynyygy <at> gmail.com:

> I've noticed font rendering differences between Emacs and other gtk
> applications like gedit. In short, Emacs ignores hintstyle setting in
> fontconfig. I have hintstyle set to hintslight in
> ~/.config/fontconfig/fonts.conf, but I have to add 'Xft.hintstyle:
> hintslight' in Xresources to get the desired effect.
> 
> The strange thing is that while ignoring hintstyle setting, Emacs still
> respect part of fontconfig settings, for example, anti-aliasing setting
> in fonts.conf will affect Emacs's font rendering.
> 

Hint setting is newer than the rest so it is possible your Emacs was compiled against a fontconfig that don't have it.
Another possibility is that you have GSettings or GConf settings that are different than fonts.conf or from the X resources.

Emacs by itself does not read fonts.conf or apply X resources, it is all done by fontconfig/Xft-libraries.  Emacs do apply GSettings and/or GConf settings.

	Jan D.


> To be more precise, if I disable anti-aliasing in fonts.conf and enable
> it in Xresources, Emacs will not have anti-aliasing; if I have
> hintslight in fonts.conf and hintnone in Xresources, Emacs will use
> hintnone.
> 
> I have tested with DejaVu Sans Mono 12 and Ubuntu Mono 13, but clearly
> it is not the fonts' problem.
> 
> 
> In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
> of 2014-06-11 on gentoo
> Windowing system distributor `The X.Org Foundation', version 11.0.11500000
> System Description:	NAME=Gentoo
> 
> Configured using:
> `configure '--prefix=/usr' '--build=x86_64-pc-linux-gnu'
> '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man'
> '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc'
> '--localstatedir=/var/lib' '--libdir=/usr/lib64'
> '--disable-silent-rules' '--disable-dependency-tracking'
> '--program-suffix=-emacs-24' '--infodir=/usr/share/info/emacs-24'
> '--localstatedir=/var'
> '--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp'
> '--with-crt-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64'
> '--with-gameuser=games' '--without-compress-info' '--without-hesiod'
> '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus'
> '--without-gnutls' '--without-xml2' '--without-selinux'
> '--without-wide-int' '--with-sound' '--with-x' '--without-ns'
> '--without-gconf' '--without-gsettings' '--without-toolkit-scroll-bars'
> '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
> '--with-xpm' '--without-imagemagick' '--with-xft' '--without-libotf'
> '--without-m17n-flt' '--with-x-toolkit=gtk3'
> 'GENTOO_PACKAGE=app-editors/emacs-24.3-r6'
> 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu'
> 'CFLAGS=-march=native -O2 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'
> 'CPPFLAGS=''
> 
> Important settings:
>  value of $LC_COLLATE: C
>  value of $LC_CTYPE: zh_CN.UTF-8
>  value of $LANG: en_US.UTF-8
>  value of $XMODIFIERS: @im=fcitx
>  locale-coding-system: utf-8-unix
>  default enable-multibyte-characters: t
> 
> Major mode: Lisp Interaction
> 
> Minor modes in effect:
>  tooltip-mode: t
>  mouse-wheel-mode: t
>  tool-bar-mode: t
>  menu-bar-mode: t
>  file-name-shadow-mode: t
>  global-font-lock-mode: t
>  font-lock-mode: t
>  blink-cursor-mode: t
>  auto-composition-mode: t
>  auto-encryption-mode: t
>  auto-compression-mode: t
>  line-number-mode: t
>  transient-mark-mode: t
> 
> Recent input:
> M-x r e p o r <tab> <return> C-y <backspace> <backspace> 
> M-x M-p <return>
> 
> Recent messages:
> For information about GNU Emacs and the GNU system, type C-h C-a.
> current-kill: Kill ring is empty
> delete-backward-char: Text is read-only [2 times]
> Quit
> 
> Load-path shadows:
> None found.
> 
> Features:
> (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
> easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
> mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
> mm-util mail-prsvr mail-utils time-date china-util tooltip ediff-hook
> vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
> regexp-opt fringe tabulated-list newcomment lisp-mode register page
> menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
> syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
> vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
> romanian slovak czech european ethiopic indian cyrillic chinese
> case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
> button faces cus-face macroexp files text-properties overlay sha1 md5
> base64 format env code-pages mule custom widget hashtable-print-readable
> backquote make-network-process dbusbind dynamic-setting
> font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
> 
> 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17792; Package emacs. (Wed, 18 Jun 2014 04:45:02 GMT) Full text and rfc822 format available.

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

From: Fangwen Yu <yynyygy <at> gmail.com>
To: Jan Djärv <jan.h.d <at> swipnet.se>
Cc: 17792 <at> debbugs.gnu.org
Subject: Re: bug#17792: 24.3;
 hintstyle specified via fontconfig is ignored by Emacs
Date: Wed, 18 Jun 2014 12:44:04 +0800
[Message part 1 (text/plain, inline)]
Clearly the fontconfig version on my system understands hint setting. As I
have said, if I have hintnone in fonts.conf and hintslight in X
resources, Emacs will use hintslight and all other gtk applications like
gedit, gnome-terminal will use hintnone.

Since Emacs is also a gtk application, why doesn't it respect fontconfig
settings?


On Tue, Jun 17, 2014 at 11:28 PM, Jan Djärv <jan.h.d <at> swipnet.se> wrote:

> Hello.
>
> 17 jun 2014 kl. 05:08 skrev yynyygy <at> gmail.com:
>
> > I've noticed font rendering differences between Emacs and other gtk
> > applications like gedit. In short, Emacs ignores hintstyle setting in
> > fontconfig. I have hintstyle set to hintslight in
> > ~/.config/fontconfig/fonts.conf, but I have to add 'Xft.hintstyle:
> > hintslight' in Xresources to get the desired effect.
> >
> > The strange thing is that while ignoring hintstyle setting, Emacs still
> > respect part of fontconfig settings, for example, anti-aliasing setting
> > in fonts.conf will affect Emacs's font rendering.
> >
>
> Hint setting is newer than the rest so it is possible your Emacs was
> compiled against a fontconfig that don't have it.
> Another possibility is that you have GSettings or GConf settings that are
> different than fonts.conf or from the X resources.
>
> Emacs by itself does not read fonts.conf or apply X resources, it is all
> done by fontconfig/Xft-libraries.  Emacs do apply GSettings and/or GConf
> settings.
>
>         Jan D.
>
>
> > To be more precise, if I disable anti-aliasing in fonts.conf and enable
> > it in Xresources, Emacs will not have anti-aliasing; if I have
> > hintslight in fonts.conf and hintnone in Xresources, Emacs will use
> > hintnone.
> >
> > I have tested with DejaVu Sans Mono 12 and Ubuntu Mono 13, but clearly
> > it is not the fonts' problem.
> >
> >
> > In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
> > of 2014-06-11 on gentoo
> > Windowing system distributor `The X.Org Foundation', version
> 11.0.11500000
> > System Description:   NAME=Gentoo
> >
> > Configured using:
> > `configure '--prefix=/usr' '--build=x86_64-pc-linux-gnu'
> > '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man'
> > '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc'
> > '--localstatedir=/var/lib' '--libdir=/usr/lib64'
> > '--disable-silent-rules' '--disable-dependency-tracking'
> > '--program-suffix=-emacs-24' '--infodir=/usr/share/info/emacs-24'
> > '--localstatedir=/var'
> > '--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp'
> > '--with-crt-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64'
> > '--with-gameuser=games' '--without-compress-info' '--without-hesiod'
> > '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus'
> > '--without-gnutls' '--without-xml2' '--without-selinux'
> > '--without-wide-int' '--with-sound' '--with-x' '--without-ns'
> > '--without-gconf' '--without-gsettings' '--without-toolkit-scroll-bars'
> > '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
> > '--with-xpm' '--without-imagemagick' '--with-xft' '--without-libotf'
> > '--without-m17n-flt' '--with-x-toolkit=gtk3'
> > 'GENTOO_PACKAGE=app-editors/emacs-24.3-r6'
> > 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu'
> > 'CFLAGS=-march=native -O2 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'
> > 'CPPFLAGS=''
> >
> > Important settings:
> >  value of $LC_COLLATE: C
> >  value of $LC_CTYPE: zh_CN.UTF-8
> >  value of $LANG: en_US.UTF-8
> >  value of $XMODIFIERS: @im=fcitx
> >  locale-coding-system: utf-8-unix
> >  default enable-multibyte-characters: t
> >
> > Major mode: Lisp Interaction
> >
> > Minor modes in effect:
> >  tooltip-mode: t
> >  mouse-wheel-mode: t
> >  tool-bar-mode: t
> >  menu-bar-mode: t
> >  file-name-shadow-mode: t
> >  global-font-lock-mode: t
> >  font-lock-mode: t
> >  blink-cursor-mode: t
> >  auto-composition-mode: t
> >  auto-encryption-mode: t
> >  auto-compression-mode: t
> >  line-number-mode: t
> >  transient-mark-mode: t
> >
> > Recent input:
> > M-x r e p o r <tab> <return> C-y <backspace> <backspace>
> > M-x M-p <return>
> >
> > Recent messages:
> > For information about GNU Emacs and the GNU system, type C-h C-a.
> > current-kill: Kill ring is empty
> > delete-backward-char: Text is read-only [2 times]
> > Quit
> >
> > Load-path shadows:
> > None found.
> >
> > Features:
> > (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
> > easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
> > mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
> > mm-util mail-prsvr mail-utils time-date china-util tooltip ediff-hook
> > vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
> > regexp-opt fringe tabulated-list newcomment lisp-mode register page
> > menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
> > syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
> > vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
> > romanian slovak czech european ethiopic indian cyrillic chinese
> > case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
> > button faces cus-face macroexp files text-properties overlay sha1 md5
> > base64 format env code-pages mule custom widget hashtable-print-readable
> > backquote make-network-process dbusbind dynamic-setting
> > font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
> >
> >
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17792; Package emacs. (Sun, 22 Jun 2014 20:55:02 GMT) Full text and rfc822 format available.

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

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: 17792 <at> debbugs.gnu.org
Subject: bug#17792: 24.3;
 hintstyle spewcified via fontconfig is ignored by Emacs
Date: Sun, 22 Jun 2014 22:54:14 +0200
2014-06-18 06:44, Fangwen Yu skrev:
> Clearly the fontconfig version on my system understands hint setting. As I
> have said, if I have hintnone in fonts.conf and hintslight in X
> resources, Emacs will use hintslight and all other gtk applications like
> gedit, gnome-terminal will use hintnone.

It isn't about the fontconfig you have in the system when you run Emacs, it is about the fontconfig used to compile Emacs and libXft.

To repeat, Emacs only applies settings from GSettings, Xsettings and GConf.
fonts.conf and X resources are not read by any Emacs code, it is all done in library code.
So if you want to change something for Emacs, you must make sure it also gets changed in one of the places Emacs reads, which is not fonts.conf or X resources settings.

Gedit uses cairo, which in turn uses fontconfig and (possibly) libXft.
I don't know if cairo itself reads fonts.conf and/or X resources, but I suspect it does.
Emacs does not use cairo, so if there are differences, it is not surprising.


> 
> Since Emacs is also a gtk application, why doesn't it respect fontconfig settings?

Emacs is not a Gtk+ application in any sense of the word, it just uses part of its widget set in one of its configurations.  Emacs does not use rendering like Gtk+ programs do, it does not use the same configuration mechanisms either.
It also violates about every Gtk+ guideline for a good Gtk+ program...

   Jan D.


> 
> 
> On Tue, Jun 17, 2014 at 11:28 PM, Jan Djärv <jan.h.d <at> swipnet.se
> <mailto:jan.h.d <at> swipnet.se>> wrote:
> 
>    Hello.
> 
>    17 jun 2014 kl. 05:08 skrev yynyygy <at> gmail.com <mailto:yynyygy <at> gmail.com>:
> 
>     > I've noticed font rendering differences between Emacs and other gtk
>     > applications like gedit. In short, Emacs ignores hintstyle setting in
>     > fontconfig. I have hintstyle set to hintslight in
>     > ~/.config/fontconfig/fonts.conf, but I have to add 'Xft.hintstyle:
>     > hintslight' in Xresources to get the desired effect.
>     >
>     > The strange thing is that while ignoring hintstyle setting, Emacs still
>     > respect part of fontconfig settings, for example, anti-aliasing setting
>     > in fonts.conf will affect Emacs's font rendering.
>     >
> 
>    Hint setting is newer than the rest so it is possible your Emacs was
>    compiled against a fontconfig that don't have it.
>    Another possibility is that you have GSettings or GConf settings that are
>    different than fonts.conf or from the X resources.
> 
>    Emacs by itself does not read fonts.conf or apply X resources, it is all
>    done by fontconfig/Xft-libraries.  Emacs do apply GSettings and/or GConf
>    settings.
> 
>             Jan D.
> 
> 
>     > To be more precise, if I disable anti-aliasing in fonts.conf and enable
>     > it in Xresources, Emacs will not have anti-aliasing; if I have
>     > hintslight in fonts.conf and hintnone in Xresources, Emacs will use
>     > hintnone.
>     >
>     > I have tested with DejaVu Sans Mono 12 and Ubuntu Mono 13, but clearly
>     > it is not the fonts' problem.
>     >





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17792; Package emacs. (Tue, 24 Jun 2014 22:17:01 GMT) Full text and rfc822 format available.

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

From: James Cloos <cloos <at> jhcloos.com>
To: Jan Djärv <jan.h.d <at> swipnet.se>
Cc: 17792 <at> debbugs.gnu.org
Subject: Re: bug#17792: 24.3;
 hintstyle spewcified via fontconfig is ignored by Emacs
Date: Tue, 24 Jun 2014 18:01:52 -0400
>>>>> "JD" == Jan Djärv <jan.h.d <at> swipnet.se> writes:

JD> I don't know if cairo itself reads fonts.conf and/or X resources,
JD> but I suspect it does.

No.  It uses the fontconfig api.

This bug is a side effect of using xft to render fonts.  LibXft has a
routine which edits the font pattern before passing on to libfontconfig;
it adds pattern elements for each of:

  antialias autohint dpi embolden hinting hintstyle lcdfilter
  maxglyphmemory maxunreffonts minspace render rgba scale

based on what it finds in the X Resources.

It always adds a pattern entry for each of those, with a default value
if it doesn't find an explicit X resource.

Fontconfig is written to allow applications to override the default
values specified in/via fonts.conf, on the reasonable theories that users
should be able to tell apps to override them, and that some applications
SHOULD avoid things like hinting, and therefore need a way to do that.

By forcing its own set of defaults, xft blocks any ability to set those
via the xml.

Fixing this will either require changing libxft to avoid adding pattern
elements for which explicit X Resources do not exist, or changing Emacs
to use fontconfig, freetype and XRENDER directly, rather than via xft.

Handa-san's original code supported an fc: prefix for fonts, which was
defined to do the above, but the xft: won out.

-JimC
-- 
James Cloos <cloos <at> jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17792; Package emacs. (Wed, 25 Jun 2014 08:33:01 GMT) Full text and rfc822 format available.

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

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: James Cloos <cloos <at> jhcloos.com>
Cc: 17792 <at> debbugs.gnu.org
Subject: Re: bug#17792: 24.3;
 hintstyle spewcified via fontconfig is ignored by Emacs
Date: Wed, 25 Jun 2014 10:32:16 +0200
Hello.

25 jun 2014 kl. 00:01 skrev James Cloos <cloos <at> jhcloos.com>:

>>>>>> "JD" == Jan Djärv <jan.h.d <at> swipnet.se> writes:
> 
> JD> I don't know if cairo itself reads fonts.conf and/or X resources,
> JD> but I suspect it does.
> 
> No.  It uses the fontconfig api.

Thanks for the clarification.

> 
> This bug is a side effect of using xft to render fonts.  LibXft has a
> routine which edits the font pattern before passing on to libfontconfig;
> it adds pattern elements for each of:
> 
>  antialias autohint dpi embolden hinting hintstyle lcdfilter
>  maxglyphmemory maxunreffonts minspace render rgba scale
> 
> based on what it finds in the X Resources.
> 
> It always adds a pattern entry for each of those, with a default value
> if it doesn't find an explicit X resource.
> 
> Fontconfig is written to allow applications to override the default
> values specified in/via fonts.conf, on the reasonable theories that users
> should be able to tell apps to override them, and that some applications
> SHOULD avoid things like hinting, and therefore need a way to do that.
> 
> By forcing its own set of defaults, xft blocks any ability to set those
> via the xml.
> 
> Fixing this will either require changing libxft to avoid adding pattern
> elements for which explicit X Resources do not exist, or changing Emacs
> to use fontconfig, freetype and XRENDER directly, rather than via xft.
> 
> Handa-san's original code supported an fc: prefix for fonts, which was
> defined to do the above, but the xft: won out.


Emacs does have the ftx font backend that gets compiled if libXft is not present.
Unfortunately it seems a bit broken w.r.t. sizes (all fonts are too large), and also the Gtk+ code in Emacs assumes Xft.  Both of these could be fixed, and we could offer both backends.

Ftx does not use XRENDER btw, so I suspect it might be a bit slow.
Another approach would be to add a draw method to the Ft backend.  Currently it is just common code for Xft and ftx.

But it seems excessive to work around something that can be made to work anyway.

	Jan D.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17792; Package emacs. (Thu, 26 Sep 2019 14:12:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: yynyygy <at> gmail.com
Cc: 17792 <at> debbugs.gnu.org
Subject: Re: bug#17792: 24.3;
 hintstyle specified via fontconfig is ignored by Emacs
Date: Thu, 26 Sep 2019 16:10:40 +0200
yynyygy <at> gmail.com writes:

> I've noticed font rendering differences between Emacs and other gtk
> applications like gedit. In short, Emacs ignores hintstyle setting in
> fontconfig. I have hintstyle set to hintslight in
> ~/.config/fontconfig/fonts.conf, but I have to add 'Xft.hintstyle:
> hintslight' in Xresources to get the desired effect.
>
> The strange thing is that while ignoring hintstyle setting, Emacs still
> respect part of fontconfig settings, for example, anti-aliasing setting
> in fonts.conf will affect Emacs's font rendering.
>
> To be more precise, if I disable anti-aliasing in fonts.conf and enable
> it in Xresources, Emacs will not have anti-aliasing; if I have
> hintslight in fonts.conf and hintnone in Xresources, Emacs will use
> hintnone.
>
> I have tested with DejaVu Sans Mono 12 and Ubuntu Mono 13, but clearly
> it is not the fonts' problem.

Is this still an issue now that harfbuzz is enabled by default on the
master branch?

Best regards,
Stefan Kangas




Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Wed, 12 Aug 2020 18:51:03 GMT) Full text and rfc822 format available.

Notification sent to yynyygy <at> gmail.com:
bug acknowledged by developer. (Wed, 12 Aug 2020 18:51:03 GMT) Full text and rfc822 format available.

Message #28 received at 17792-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: yynyygy <at> gmail.com
Cc: 17792-done <at> debbugs.gnu.org
Subject: Re: bug#17792: 24.3;
 hintstyle specified via fontconfig is ignored by Emacs
Date: Wed, 12 Aug 2020 11:50:26 -0700
Stefan Kangas <stefan <at> marxist.se> writes:

> yynyygy <at> gmail.com writes:
>
>> I've noticed font rendering differences between Emacs and other gtk
>> applications like gedit. In short, Emacs ignores hintstyle setting in
>> fontconfig. I have hintstyle set to hintslight in
>> ~/.config/fontconfig/fonts.conf, but I have to add 'Xft.hintstyle:
>> hintslight' in Xresources to get the desired effect.
>>
>> The strange thing is that while ignoring hintstyle setting, Emacs still
>> respect part of fontconfig settings, for example, anti-aliasing setting
>> in fonts.conf will affect Emacs's font rendering.
>>
>> To be more precise, if I disable anti-aliasing in fonts.conf and enable
>> it in Xresources, Emacs will not have anti-aliasing; if I have
>> hintslight in fonts.conf and hintnone in Xresources, Emacs will use
>> hintnone.
>>
>> I have tested with DejaVu Sans Mono 12 and Ubuntu Mono 13, but clearly
>> it is not the fonts' problem.
>
> Is this still an issue now that harfbuzz is enabled by default on the
> master branch?

More information was requested, but none was given within 45 weeks, so
I'm closing this bug.  If this is still an issue, please reply to this
email (use "Reply to all" in your email client) and we can reopen the
bug report.

Best regards,
Stefan Kangas




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Sep 2020 11:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 341 days ago.

Previous Next


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