From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.help Subject: Re: script-representative-chars vs incomplete fonts Date: Sun, 12 Sep 2021 19:08:35 +0200 Message-ID: <87sfy9wwks.fsf@gmail.com> References: <878s02u5m6.fsf@gmail.com> <83tuiqfidr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15083"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 12 19:09:18 2021 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 1mPSyk-0003kC-99 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 19:09:18 +0200 Original-Received: from localhost ([::1]:48348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPSyj-0000AW-1x for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 13:09:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPSyA-0000AG-EZ for help-gnu-emacs@gnu.org; Sun, 12 Sep 2021 13:08:42 -0400 Original-Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:41637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPSy8-0008Uv-Bc; Sun, 12 Sep 2021 13:08:42 -0400 Original-Received: by mail-wr1-x430.google.com with SMTP id w29so10113293wra.8; Sun, 12 Sep 2021 10:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=TFLxgS6uDZ9Z9AzXsHC5tstxcxbmVxUpbk8JsFE4EIk=; b=bqoi/ao9lUTUKuJlJfVw2O0XVJh8jAZsGhT8bo02y5Y5phO1u7AtOjbXvpV30wX/89 2N6eql2BAe3JvrlZtiLTD6+2cuLKB5PtoLdLqBSkqZDXPTlsw+tuUYUv7UwIJkflecFq NcooS48CFOU4GHJYIvrR14jHcUtBE9jVIPc2AdSfLnScNB9CpRNHuv1qjvRALRPQ6/dN NeENC+jhH6zURt8M1uXwnl2JcwZaP5Wssmr+E1229k6sr8F4mo42poemZxLULMIeaBfF Xx3OSFpUapDRyREZqsm4Qv2iQf29RV3Qc452WtlJBC5YFaRo6z5OImkK0bvVuOTuIteO 1uUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=TFLxgS6uDZ9Z9AzXsHC5tstxcxbmVxUpbk8JsFE4EIk=; b=Mj2x1uavpGSAkQbeA5zjFlrqQXOyxNaAk9Jc8BqnO6qA5pSrkoh3qmXEguKyhNJX7w L9kWoWbbgcIioEo072re8vR71X47jCjb+0ZPNs8ni8Cw2yzvYZOaSoQKHTUyrs4Z5R13 9lQUNUE/ElsMmVouPTecauqqFmnNkBirAEAYA/CeKsLJ8DBYLThdrUBBsAgpgY6iSiAb nLZz+Ofa708+iDwfxnv1ODszvUxRzXUj5X3m4bmZIB5jaTf8c3z0ejkZyXbYRKQGJHAF IUGmU9LF+EmiH2kiTbNFTq/ObAUI2JTH/HZCyFYOkyCCEyZRXr1VBH+3I9mGGbmpcMtS 5Xtg== X-Gm-Message-State: AOAM530E5isD+ItkmynkRPDjsE+yNi/7QThfplrzxN4qxWMNO75Wcpe/ /6zxzrf2UMlFN9CIA5E6/jaYcZKs1Ps= X-Google-Smtp-Source: ABdhPJxeYqskgZ9rlzLVpo8tRPtMO3q/vcVjYGm3Ez6vkf0hS7WLhdVfGRwhBifKGsy99YCSe8/6MA== X-Received: by 2002:a5d:668c:: with SMTP id l12mr8160093wru.436.1631466516957; Sun, 12 Sep 2021 10:08:36 -0700 (PDT) Original-Received: from amdahl30 ([2a01:e0a:20e:d340:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id p5sm5490330wrd.25.2021.09.12.10.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 10:08:36 -0700 (PDT) In-Reply-To: <83tuiqfidr.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 12 Sep 2021 08:54:56 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.help:133010 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thanks for your insights, Eli! Some follow-up thoughts & questions. Eli Zaretskii writes: >> On my system, I happen to have >>=20 >> - one font (KpMath) that provides U+1D49C=E2=80=93U+1D4B5 (the "capital"= chars), >> but not U+1D4B6=E2=80=93U+1D4CF (the "small" chars), >>=20 >> - another font (DejaVu Math TeX Gyre) that provides both sub-ranges[1]. >>=20 >> As luck would have it, when trying to display a char in this range, >> Emacs stumbles on KpMath first > > It's not Emacs that stumbles on that font, it's your font backend > (probably fontconfig?). Emacs just verifies that the candidate fonts > returned by the backend satisfy the requirements, and uses the first > font that does. So this might mean a bug report for fontconfig and/or > the font designers is in order. Right; "as luck would have it", fontconfig returns KpMath rather than DejaVu Math TeX Gyre; that's because Emacs only asks for U+1D49C, if I'm reading ftfont.c's use of Vscript_representative_chars correctly? So I'm not sure there's a bug on fontconfig's end? FWIW the CLI tools seem to provide accurate information[1]. >> E.g. in fontset.el, would it be overkill to break down the 52-char >> ranges in the math-subgroup loop into 2 26-char ranges in order to >> always add the "SMALL A" codepoints to script-representative-chars? > > What would be the purpose of breaking that range? > script-representative-chars can specify multiple characters per > script, see its doc string. Right now script-representative-chars contains this: > (mathematical-script 119964) With this patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 3deaff9677..461c8f830a 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -772,7 +772,8 @@ setup-default-fontset (dolist (math-subgroup '((#x1D400 #x1D433 mathematical-bold) (#x1D434 #x1D467 mathematical-italic) (#x1D468 #x1D49B mathematical-bold-italic) - (#x1D49C #x1D4CF mathematical-script) + (#x1D49C #x1D4B5 mathematical-script) + (#x1D4B6 #x1D4CF mathematical-script) (#x1D4D0 #x1D503 mathematical-bold-script) (#x1D504 #x1D537 mathematical-fraktur) (#x1D538 #x1D56B mathematical-double-struck) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable script-representative-chars would contain: > (mathematical-script . [119964 119990]) I meant that suggestion as a band-aid fix if we deem that Emacs should guard against these "incomplete" fonts. Not sure it makes sense as-is though, since it yields a vector; judging by script-representative-chars's docstring (and a cursory glance at ftfont_list and font_match_p), a list would be more appropriate, to make all codepoints mandatory? >> 1. (push #x1D4CF (alist-get 'mathematical-script >> script-representative-chars)) >> 2. (set-fontset-font >> t 'mathematical "DejaVu Math TeX Gyre" nil 'prepend) >> 3. Uninstall KpMath. > > I'd suggest to do 3 regardless. A font that supports only part of a > block is a bad font to have. (Right; AFAICT KpMath got pulled in when I installed TeXLive. I'm not entirely sure why the font was designed this way; I couldn't find a rationale in the documentation hosted on CTAN[2]) > Emacs should probably do the equivalent of 1 OK; I'll try to follow-up with a bug report and a patch SomeDay=E2=84=A2 th= en. Again, thanks for your explanations. [1] $ fc-list ':charset=3D1d4c1' =E2=87=92 a bunch of fonts, including DejaVu Math TeX Gyre but *not* KpMath $ fc-match -f '%{charset}\n' 'KpMath' =E2=80=A6 1d456-1d49c 1d49e-1d49f 1d4a2 1d4a5-1d4a6 1d4a9-1d4ac 1d4ae-1d4b5 1d4d0-1d4e9 =E2=80=A6 =E2=87=92 includes U+1D49C=E2=80=93U+1D4B5 (minus nonexistent codepoints) b= ut not U+1D4B6=E2=80=93U+1D4CF $ fc-match -f '%{charset}\n' 'DejaVu Math TeX Gyre' =E2=80=A6 1d456-1d49c 1d49e-1d49f 1d4a2 1d4a5-1d4a6 1d4a9-1d4ac 1d4ae-1d4b9 1d4bb 1d4bd-1d4c3 1d4c5-1d505=E2=80=A6 =E2=87=92 includes U+1D49C=E2=80=93U+1D4B5 *and* U+1D4B6=E2=80=93U+1D4CF (m= inus nonexistent codepoints) [2] https://ctan.org/pkg/kpfonts https://ctan.org/pkg/kpfonts-otf The "List of glyphs" document from this second page, =C2=A7 15.1.8, features a table that clearly shows that KpMath (column "K") does not contain the lowercase glyphs, but I fail to find a design rationale. --=-=-=--