this post was submitted on 20 Nov 2023
1 points (100.0% liked)

Emacs

311 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Screenshot: https://0x0.st/Hwru.jpg

In this Screenshot you see the frames of two Emacs processes. The left frame has been started by emacs -q, while the right frame has been started by emacs -Q. So no personal configuration (besides .Xresources) is used. The version is Emacs 29.1., X11, Linux.

The left frame shows the font I'd like to use, and used since many years with Emacs already. But the left frame also shows a "distorted" display of example characters. The important character is . It is clearly visible in this screenshot, that Emacs changes the font (glyph?) to display this character if the character needs to be rendered in bold. (similar things happen to other characters or itallic)

Each frame has 3 windows. The top window shows an org buffer with various characters.

The second from top window is the output of what-cursor-position, of the normal rendered character.

The bottom window shows the output of what-cursor-position with a bold character where Emacs changed the font to display this character. (This lines are much wider and taller, even though they contain the same number of monospaced letters.)

Emacs did not had this behavior of changing fonts to display certain characters in versions v28.x and older (at least I never noticed it). I did not change OS installed packages, fonts, setting and stuff, so I'm pretty sure it's an Emacs v28.x to v29.1 related change.

What can I do to make Emacs behave like in older versions, i.e. not changing fonts to display those characters?

I tried various things (i.e. disabling HarfBuzz), but I am clueless what I need to configure.

I know that the problematic setting is a *font: line in my .Xresources file. But finding a suitable font was some time consuming frustrating process, because I didn't like other fonts for various (mostly readability or size) reasons.

TL;DR: Question: how can I make Emacs v29.1 to not change fonts to display certain characters?

top 1 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 11 months ago

This is for documentation, in case someone else has a similar problem.

I sort of worked around Emacs weird choosing of fonts, since I do not know the real problem. Maybe it is a bug?

I put following in my init.el (I'm not fully satisfied, yet):

  (set-fontset-font "fontset-startup" '(#x2190 . #x21fe) "-misc-fixed-*-*-*--*-*-75-75-c-60-iso10646-1") ;; unicode arrows
  (set-fontset-font "fontset-startup" #x2026 "-misc-fixed-*-*-*--9-90-75-75-c-60-iso10646-1") ;; the …

Docs say it is possible to define a fontset in .Xresources, but I did not try.

You can check your current fontset via M-x describe-fontset.

My configuration uses fontset-startup primarily and fontset-default as fallback. So I modified fontset-startup.

The codepoint for characters (required second parameter for set-fontset-font) can be retrieved via C-u C-x =. All that is documented in the Emacs manual, btw.

Test if those settings work, by opening a org-mode buffer and using bold (*TEST*) and italic (/TEST/) on characters you want to test.