all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Question] How to change the height of the box for unprintable glyphs?
@ 2024-05-15 17:37 Rodrigo Morales
  2024-05-15 18:27 ` Eli Zaretskii
  2024-05-15 19:26 ` Rodrigo Morales
  0 siblings, 2 replies; 7+ messages in thread
From: Rodrigo Morales @ 2024-05-15 17:37 UTC (permalink / raw)
  To: help-gnu-emacs


* The context

In some of my use cases, I feel the need to use a bitmap font in a =*terminal*= buffer.

Some days ago, I noticed that some lines in a =*terminal*= buffer were shown with a different height. This caused the tmux status bar when it is shown at the top to be shown out of the =*terminal*= buffer. This is undesired behavior. I learned that this happened because Emacs tries to display some characters using different fonts which might have different heights. For this reason, I started looking for a bitmap font which defines glyphs for all Unicode characters. Thus, by using a single font, the height of all lines would be the same. I found GNU Unifont.

I downloaded the file =unifont-15.1.05.pcf.gz= from https://unifoundry.com/unifont/ . Then, I decompressed the file using =gunzip= and copied the file =unifont-15.1.05.bdf= to =~/.fonts=. Finally, I executed =fc-cache -f -v=.

I launched =emacs -Q /tmp/a.txt= (the contents of =/tmp/a.txt= are shown in the first code block below).

#+HEADER: :tangle /tmp/a.txt
#+BEGIN_SRC text
Line 1: Hello!
Line 2: 你好!
Line 3: 𑂩𑂰𑂧𑂩𑂰𑂧 ("Hello" in Kaithi, retrieved from HELLO buffer in GNU Emacs 29.3)
#+END_SRC

I then tried to make Emacs display all characters only using Unifont. If the glyph is not defined by Unifont, then a box with the hexadecimal notation of the character should be shown. I accomplished this by evaluating the following sexpL

#+HEADER: :results silent
#+BEGIN_SRC elisp
(progn
 (set-fontset-font "fontset-startup" '(#x000000 . #x3FFFFF) "Unifont")
 (set-fontset-font "fontset-default" '(#x000000 . #x3FFFFF) "Unifont"))
#+END_SRC

Upon evaluation of the sexp, all characters in the buffer =a.txt= except characters in line 3 were shown using GNU Unifont, boxes with hexadecimal notation were shown in line 3. See screenshot in http://web.archive.org/web/20240515172349/http://0x0.st/XK5h.png

The boxes shown in line 3 significantly increased the height of that line. =(line-pixel-height= returned 16 in line 1 and line 2, but it returned 37 in line 3.

* The question

How to reduce the height of the rectangle containing hexadecimal notation that Emacs uses to display characters for which no font was found?

* The XY problem

To avoid [[https://www.perlmonks.org/?node_id=542341][the XY problem]], I want to make clear that my main goal is to use a bitmap font in a =*terminal*= buffer and ensure that all lines have the same height (the X). One way that I found to accomplish this is by using a bitmap font that defines glyphs for most characters. However, this raised the problem that undefined glyphs are shown with a larger height (the Y).



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-17 14:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 17:37 [Question] How to change the height of the box for unprintable glyphs? Rodrigo Morales
2024-05-15 18:27 ` Eli Zaretskii
2024-05-15 21:28   ` Rodrigo Morales
2024-05-16 19:08     ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-05-16 19:35       ` Eli Zaretskii
2024-05-17 14:12         ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-05-15 19:26 ` Rodrigo Morales

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.