From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rodrigo Morales Newsgroups: gmane.emacs.help Subject: [Question] How to change the height of the box for unprintable glyphs? Date: Wed, 15 May 2024 12:37:43 -0500 Message-ID: <6aad61b5057ea92af6fd5f9daef953bc@rodrigomorales.site> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24386"; mail-complaints-to="usenet@ciao.gmane.io" To: Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 15 19:38:39 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s7IaN-00069I-VC for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 15 May 2024 19:38:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7IZl-0000CQ-3K; Wed, 15 May 2024 13:38:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7IZj-0000CI-4y for help-gnu-emacs@gnu.org; Wed, 15 May 2024 13:37:59 -0400 Original-Received: from smtpout1.mo12.mail-out.ovh.ca ([51.161.45.254]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7IZh-00055C-5C for help-gnu-emacs@gnu.org; Wed, 15 May 2024 13:37:58 -0400 Original-Received: from mxplan1.mail.ovh.ca (unknown [10.111.38.43]) by mo12.mail-out.ovh.ca (Postfix) with ESMTPS id 4VfgRF3wMXzHpvm for ; Wed, 15 May 2024 14:37:45 -0300 (ADT) Original-Received: from rodrigomorales.site (54.39.251.57) by DAG2EX1.mxpca1.local (172.16.2.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 15 May 2024 13:37:44 -0400 Authentication-Results: garm.ovh; auth=pass (GARM-95B002c008af6e-1175-4df5-abac-d36e0a1cbd18, 9430FB427A4A35C8BA01D3BD7E876FFBC3E15BA8) smtp.auth=me@rodrigomorales.site X-OVh-ClientIp: 190.232.101.8 X-Originating-IP: [54.39.251.57] X-ClientProxiedBy: DAG2EX1.mxpca1.local (172.16.2.11) To DAG2EX1.mxpca1.local (172.16.2.11) X-Ovh-Tracer-GUID: 767ffecd-4b13-4347-910d-cbf05aaaed14 X-Ovh-Tracer-Id: 17503521430347193879 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrvdegkedguddtlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhepfffkhffvufggtgfgihesthekjhdttddtjeenucfhrhhomheptfhoughrihhgohcuofhorhgrlhgvshcuoehmvgesrhhoughrihhgohhmohhrrghlvghsrdhsihhtvgeqnecuggftrfgrthhtvghrnhephfeijeffgfevgfefkeevhedvhfetudeftefhgeevtdejveejteeufeduieefgeetnecuffhomhgrihhnpehunhhifhhouhhnughrhidrtghomhdprghrtghhihhvvgdrohhrghdptdigtddrshhtpdhpvghrlhhmohhnkhhsrdhorhhgnecukfhppeduvdejrddtrddtrddupdehgedrfeelrddvhedurdehjedpudeltddrvdefvddruddtuddrkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepmhgvsehrohgurhhighhomhhorhgrlhgvshdrshhithgvpdhnsggprhgtphhtthhopedupdhrtghpthhtohephhgvlhhpqdhgnhhuqdgvmhgrtghssehgnhhu rdhorhhgpdfovfetjfhoshhtpehmohduvddpmhhouggvpehsmhhtphhouhht Received-SPF: pass client-ip=51.161.45.254; envelope-from=me@rodrigomorales.site; helo=smtpout1.mo12.mail-out.ovh.ca X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146758 Archived-At: * 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).