From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Greg A. Woods" Newsgroups: gmane.emacs.bugs Subject: bug#53924: 26.1; fontification sometimes fails for some characters despite available glyphs Date: Mon, 14 Feb 2022 18:01:43 -0800 Organization: Robo-Hacker Message-ID: References: <838ruitqu9.fsf@gnu.org> <834k55ub5u.fsf@gnu.org> <83k0dzq8y0.fsf@gnu.org> Reply-To: "Greg A. Woods" , GNU Emacs Bug Reports <53924@debbugs.gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Mon_Feb_14_18:01:24_2022-1"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1915"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/26.1 (x86_64--netbsd) MULE/6.0 (HANACHIRUSATO) Cc: GNU Emacs Bug Reports <53924@debbugs.gnu.org> To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 15 03:02:38 2022 Return-path: Envelope-to: geb-bug-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 1nJnAs-0000JH-Gf for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 03:02:38 +0100 Original-Received: from localhost ([::1]:56822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJnAr-00011y-KW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Feb 2022 21:02:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJnAJ-00010h-2I for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2022 21:02:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJnAI-0008VQ-OW for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2022 21:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nJnAI-0007kO-Ld for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2022 21:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Greg A. Woods" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Feb 2022 02:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53924 X-GNU-PR-Package: emacs Original-Received: via spool by 53924-submit@debbugs.gnu.org id=B53924.164489051329762 (code B ref 53924); Tue, 15 Feb 2022 02:02:02 +0000 Original-Received: (at 53924) by debbugs.gnu.org; 15 Feb 2022 02:01:53 +0000 Original-Received: from localhost ([127.0.0.1]:43141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJnA5-0007ju-CJ for submit@debbugs.gnu.org; Mon, 14 Feb 2022 21:01:53 -0500 Original-Received: from [198.96.117.51] (port=55033 helo=central.weird.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJnA3-0007jk-5A for 53924@debbugs.gnu.org; Mon, 14 Feb 2022 21:01:47 -0500 Original-Received: from (invalid client hostname: bind: DNS error: DNS lookup for A for 'more.local': Unknown host)more.local ((no PTR matching greeting name (Invalid rDNS PTR target 'd207-6-82-137.bchsia.telus.net': bind: DNS error: DNS lookup for A for 'd207-6-82-137.bchsia.telus.net': Unknown host))d207-6-82-137.bchsia.telus.net[207.6.82.137] port=61798) by central.weird.com([198.96.117.51] port=587) via TCP with esmtp (10794 bytes) (sender: ) (ident using UNIX) id for <53924@debbugs.gnu.org>; Mon, 14 Feb 2022 21:01:46 -0500 (EST) (Smail-3.2.0.122-Pre 2005-Nov-17 #1 built 2022-Feb-11) Original-Received: from more.local ([10.0.1.129] port=61799) by more.local([10.0.1.129] port=25) via TCP with esmtp (10163 bytes) (sender: ) id for <53924@debbugs.gnu.org>; Mon, 14 Feb 2022 18:01:43 -0800 (PST) (Smail-3.2.0.122-Pre 2005-Nov-17 #1 built 2022-Feb-11) In-Reply-To: <83k0dzq8y0.fsf@gnu.org> X-Face: ; j3Eth2XV8h1Yfu*uL{<:dQ$#E[DB0gemGZJ"J#4fH*][ lz; @-iwMv_u\6uIEKR0KY"=MzoQH#CrqBN`nG_5B@rrM8,f~Gr&h5a\= List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226958 Archived-At: --pgp-sign-Multipart_Mon_Feb_14_18:01:24_2022-1 Content-Type: text/plain; charset=US-ASCII At Sun, 13 Feb 2022 13:53:27 +0200, Eli Zaretskii wrote: Subject: Re: bug#53924: 26.1; fontification sometimes fails for some characters despite available glyphs > > > (font-families (cl-remove-duplicates > > (sort (font-family-list) > > (lambda(x y) (string> (upcase x) (upcase y)))) > > :test 'cl-equalp))) > > This is not recommended as a way to get useful fonts. Perhaps you can explain that better or differently so I can try to understand? I chose font-family-list because it is (supposedly) window-system agnostic. Indeed it works fine on macOS too, and it transparently even does approximately the right thing on a TTY. > My suggestion > is to use the following instead: > > (delete-dups > (x-list-fonts "-*-*-medium-r-normal-*-*-*-*-*-*-iso10646-1" > 'default (selected-frame))) BTW, delete-dups is wrong, but I finally found seq-uniq (to avoid cl-lib): (seq-uniq (sort (font-family-list) (lambda(x y) (string> (upcase x) (upcase y)))) (lambda(x y) (string= (upcase x) (upcase y)))) > Indeed, using x-list-fonts indiscriminately could very well include > fonts that Emacs cannot use or even those which will crash Emacs. Indeed -- that's another reason why I chose not to use x-list-fonts! > Is this with the above Lisp program that tries all the fonts collected > by font-family-list, or is this with some other recipe to reproduce > the crash? Also, was that in "emacs -Q"? It turns out the crash happens with one font in particular, "Inconsolata". I have some cleanup of the versions of that font in particular that I need to do to be sure I know which one is being used. I can also now confirm the same crash occurs with both GTK+2.0 and with the Lucid (xaw3d) toolkits, and in both 26.1 and today's Git "master". The strange behaviour with glyph selection in some fonts also occurs with the Lucid toolkit, and on today's Git "master". The Lucid toolkit though seems to do font-scaling bass-ackwards w.r.t. handling display resolution, and it also chooses "fixed" as the default base font, which is not scalable (though that makes the effects of the incorrect glyph choices extremely obvious on a hi-res display since the bad glyphs are now 1/4 the size they should be). -- Greg A. Woods Kelowna, BC +1 250 762-7675 RoboHack Planix, Inc. Avoncote Farms Latest show-all-font-families: (defun show-all-font-families (&optional sample-text mono-only) "Show SAMPLE-TEXT (by default `list-faces-sample-text') in 'roman', 'bold', 'italic', and 'bold italic' for each font family known to `font-family-list'. If MONO-ONLY, include ':spacing m' in the `font-spec' parameters. Interactively, a negative prefix does the same. Note you can seem some strange results for fonts that don't have each of the requested weight and slant forms. Sometimes proportional glyphs will even be substituted for mono-spaced glyphs! Sometimes a glyph from a different font (the default font?) will be substituted even when the requested font is available with all the requested attributes, e.g. 'office code pro'. (Perhaps because it is _only_ avaliable with the requested attributes, but no others?) Also some proportional fonts will show up despite only mono-spaced fonts being selected. Perhaps spacing is ignored when requesting a font? Note even `x-list-fonts' warns that: Fonts Emacs can't use may or may not be excluded... N.B. WARNING: This code may try to display fonts that cannot be opened and as a result will crash Emacs! Worse yet it can get stuck rendering fonts and if killed cause the X11 server to go into a CPU-bound loop that may take hours to resolve! Kill it sooner than later! This is particularly true for Emacs-26.1 when the MONO-ONLY parameter is non-nil. See also the exclusion of the 'droid' fonts. Derived from an example on the EmacsWiki." (interactive (list ;; optional `sample-text': (if current-prefix-arg (read-string "Sample text: " ascii-sample-text 'sample-text-history)) ;; optional `mono-only': (cond ((eq current-prefix-arg '-) t) ((and (numberp current-prefix-arg) (< current-prefix-arg 0)) t) ((and (listp current-prefix-arg) (numberp (car current-prefix-arg)) (< (car current-prefix-arg) 0)) t) (t nil)))) (let ((str (if sample-text sample-text list-faces-sample-text)) (font-families (seq-uniq ;; note: the list is reversed so that font text is ;; inserted in the demo buffer the right order (sort (font-family-list) (lambda(x y) (string> (upcase x) (upcase y)))) (lambda(x y) (string= (upcase x) (upcase y)))))) (with-help-window "*Font Families*" (with-current-buffer standard-output (dolist (ff font-families) (let* ((fs (font-spec :family ff ; :weight 'medium :slant 'r ;; xxx :spacing is confusing ;; see below for additional test to confirm! (if mono-only :spacing) (if mono-only 'm) :dpi (round (/ (display-pixel-height) (/ (display-mm-height) 25.4))) :registry 'iso10646-1)) (fl (list-fonts fs)) (fe (car fl)) ; usually the cdr is non-scalable? (xlfd (if fe (font-xlfd-name fe) (font-xlfd-name fs))) ; xxx font may not be useable (fn (if (eq window-system 'x) (condition-case nil (x-resolve-font-name xlfd) (error (message "Invalid font family: %s" ff) nil)) nil)) (xlfd-fields (if fn (x-decompose-font-name fn) ; xxx not really an X11 function nil)) ) ;; XXX the "droid*" fonts are broken??? (if (and (not (string-match "droid" ff)) (not (string-equal "inconsolata" ff)) ; xxx may crash Emacs!!! (not (string-equal "nil" ff)) ; xxx never a useful font ; (not (string-match "italic" ff)) ; xxx rarely in all other styles ; (not (string-match "bold" ff)) ; xxx rarely in all other styles (not (string-match ".pcf" ff)) ; xxx usually bitmap cursors ;; ;; xxx some fonts, e.g. "inconsolata" (which xfontsel says ;; is both 'm' and 'p'), will return the "wrong" spacing in ;; the XLFD if the request has a wild-card (i.e. :spacing ;; unspecified), but then it can't be found with ;; `font-info' with the explicit ":spacing 'p". ;; (condition-case nil (if (font-info xlfd) ; xxx can this also return nil? t (message "Can't get font info for: %s" xlfd) nil) (error (message "Bad font: %s" xlfd) nil)) (if mono-only (if xlfd-fields ;; because `x-resolve-font-name' sometimes ignores ;; `:spacing' we must confirm the font matches ;; xxx `xlfd-regexp-spacing-subnum' is WRONG, for 20 years! (if (string-equal (aref xlfd-fields 9) "m") t (message "Font not actually monospaced: %s" xlfd) nil) ;; xxx try `font-get' on `fe', but that doesn't seem to ;; work properly for getting `:spacing'!?!?!?!? (if (eq window-system 'x) (message "Can't resolve X font for: %s" xlfd))) t)) (progn (message "Inserting text for font: %s" xlfd) ;; xxx XXX N.B.: without escaping the semicolons emacs can't ;; parse these expressions backwards!!! (insert "\; " ff ":" xlfd "\n\;\n" "\;\t" ff " (plain):\n\;\n" (propertize str 'font-lock-face `(:family ,ff :weight medium :slant r)) "\n\;\n\;\t" ff " [bold]:\n\;\n" (propertize str 'font-lock-face `(:family ,ff :weight bold :slant r)) "\n\;\n\;\t " ff " [italic]:\n\;\n" (propertize str 'font-lock-face `(:family ,ff :weight medium :slant italic)) "\n\;\n\;\t " ff " [bold italic]:\n\;\n" (propertize str 'font-lock-face `(:family ,ff :weight bold :slant italic)) "\n\;\n \n")) (message "Not showing font-family: %s" ff))) (goto-char (point-min)) (setq case-fold-search t) (if (fboundp 'form-feed-mode) (form-feed-mode nil))))))) --pgp-sign-Multipart_Mon_Feb_14_18:01:24_2022-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit Content-Description: OpenPGP Digital Signature -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQTWEnAIIlcZX4oAawJie18UwlnHhQUCYgsJeQAKCRBie18UwlnH hToxAJ0TYOTatmehQnwPB59Petb+QKgx5gCghnyrZlyV1ehU0+TZ7CDJX3LGTAE= =eLGc -----END PGP SIGNATURE----- --pgp-sign-Multipart_Mon_Feb_14_18:01:24_2022-1--