From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Sergey Organov Newsgroups: gmane.emacs.help Subject: Re: How to enforce unicode font for all charsets? Date: Thu, 12 Mar 2020 09:53:05 +0300 Message-ID: <87wo7qqd2m.fsf@osv.gnss.ru> References: <874kuwphsz.fsf@osv.gnss.ru> <83wo7s9sgt.fsf@gnu.org> <87a74niii8.fsf@osv.gnss.ru> <83blp2aldx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="129537"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (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 Thu Mar 12 07:53:39 2020 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 1jCHis-000XbR-UF for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 12 Mar 2020 07:53:39 +0100 Original-Received: from localhost ([::1]:36748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCHir-0005BI-Vq for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 12 Mar 2020 02:53:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60617) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCHiQ-0005BC-Ss for help-gnu-emacs@gnu.org; Thu, 12 Mar 2020 02:53:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCHiP-0000G3-2K for help-gnu-emacs@gnu.org; Thu, 12 Mar 2020 02:53:10 -0400 Original-Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]:37539) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCHiO-0000EJ-Np; Thu, 12 Mar 2020 02:53:09 -0400 Original-Received: by mail-lf1-x135.google.com with SMTP id j11so3855788lfg.4; Wed, 11 Mar 2020 23:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:user-agent:date:message-id :mime-version; bh=RWk/UOiMhDpUIUwM6OZ1df9TIWnP9A19vyXym65iywg=; b=Cy39wBCOM2Vh3kE1RRzPSaGjcTR+IrdxlpiqsEQE0Rqe4+hcDZDNBn/OVYC0gRVPZ4 GJ5pMx1md4woWp1X2S3xGY4x1Pkcy5pSVN8BOeqWV0+rsRs4ZI4qAd+JaJ7BkfLykDhm 9+ppt2LqquiRGLkCK8ZhihspXHvKnSCYKKSODfc7nstimgiCCifUg05YmDOxmn/MZigW OPwaKER2kEujRQb3XH4B5C6My7wryC6rDRSgHQKiCuLti9SNajEsyTuaxWCoedEbevmx /mM07aaPLblRqS7BqOdTcr7OlOgpCa7u9UdCWjO5v3RWXfgdPnmCjpBx4hNKza66mUQA ApNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:user-agent:date :message-id:mime-version; bh=RWk/UOiMhDpUIUwM6OZ1df9TIWnP9A19vyXym65iywg=; b=EEfM1buDPFoMUbRPRySY/Ymwbqzlgs/XDQtoF8yH6YB4wznVNe24yDFp0+9GZCRgLR yWQ3JTqRw0wUlTyB2SfagB6m/3+q73ucNJ8MrZhLX0gh4nZgXabpwRHJQtTqM26WER4w U0KixoxqZR/BrXJ0+OboIvgjBlaziLUJej4QsA2lUnXvP2CBXz636cM8mf2t1NrEuiIM 3Ut7siSK55q0plJz1lev6O4qkrwe7ZON5qboZU/fDLrSfLscCydk2WxvK1Ty7vGLrSyH o4UTJcMCWZqpqKQA31QFhUY0Be1KdyqKT83K5XWO6AhyEDltfLCjtL6nTRdD8d6eckB4 CT4w== X-Gm-Message-State: ANhLgQ3+hpLxWh/GNcOTbACYpsfT5JQUWGrgSjf5alvJcmdnPetID7zb iwNe8Al4Ndfp/YT8Gezhbku8MJQ3 X-Google-Smtp-Source: ADFU+vv3O0VkKUMM87MAAhV3ODi6x5pqiH0nzQKj+msQ1QVOn1Hnh+6aTUlEIYaXrW06BAvNwBe/Dw== X-Received: by 2002:ac2:5f6d:: with SMTP id c13mr1527845lfc.9.1583995986598; Wed, 11 Mar 2020 23:53:06 -0700 (PDT) Original-Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id w14sm24527192ljo.80.2020.03.11.23.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 23:53:05 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::135 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:122566 Archived-At: Eli Zaretskii writes: >> From: Sergey Organov >> Cc: Eli Zaretskii >> Date: Wed, 11 Mar 2020 08:10:39 +0300 >> >> I mean, it looks like I need to modify fontset-auto1, as M-x >> describe-fontset RET shows: >> >> Fontset: -PfEd-DejaVu Sans Mono-normal-normal-normal-*-23-*-*-*-m-0-fontset-auto1 > > No, you want to customize fontset-default. OK, thanks, this snippet from my init.el now does the trick: (setq custom-file "~/.emacs.d/custom.el") (load custom-file) (set-fontset-font t '(#x0 . #x3FFFFF) (font-xlfd-name (face-attribute 'default :font))) I've also tried 'windows-1251 instead of character range and it also achieves the goal. > >> and after some more digging, I finally tried: >> >> (set-fontset-font "fontset-auto1" 'windows-1251 >> (font-xlfd-name (face-attribute 'default :font)) > > Use 'prepend as the 5th argument of set-fontset-font, for more > predictable results. I've tried to add `nil 'prepend` at the end: (set-fontset-font t '(#x0 . #x3FFFFF) (font-xlfd-name (face-attribute 'default :font)) nil 'prepend) but it actually unpredictably /stopped/ to do its intended job. Yet another mystery to me. > >> which evaluates to: >> >> "-PfEd-DejaVu Sans Mono-normal-normal-normal-*-23-*-*-*-m-0-iso10646-1" >> >> but doesn't seem to have any visible effect. > > Please describe how you tested that. That one had a simple mistake: one close paren less, so I've in fact evaluated just: (font-xlfd-name (face-attribute 'default :font)) sorry! > >> And even if that worked, it wouldn't immediately pick subsequent >> customization of the default face anyway? > > Fontset customizations are independent of faces, so I don't think I > understand what you mean by "picking customizations of the default > face". They both (independently) affect displaying, and customization of fontset seems to effectively override (parts of) customization of default face. Let me give an example. Thanks for your support, I've now got tweaked fontset-default as described above that makes windows-1251 text to be displayed in DejaVu font, being the font family of the default face as it is /at startup/. Fine so far. Now suppose somewhere in the future I find a font that looks better than DejaVu. What I usually do to switch font is: M-x customize-face RET default RET, then change font family to what I need. Let's try it. I do M-x customize-face RET default RET, change font family of default face from "DejaVu Sans Mono" to "Courier" and click "Set for Current session". What I get is an ugly mixture of Courier font for ASCII text and DejaVu Sans Mono for the rest. That's what I meant by /no immediate/ "proper" pick-up of customization. The DejaVu is now "sticky" due to tweaked fontset, and is not changed by customization of the default face. (I admittedly don't understand why ASCII text is different, as I've customized the entire range of codepoints, but that's just yet another mystery of fonts management.) To get consistent (now all-Courier) fonts, I'd need to click "Save for future sessions" and then restart Emacs for (set-fontset-font ...) call to pick new customized font family at startup. > In general, if the default face's font supports some character, Emacs > will use that font, so I don't quite understand why you need to > customize your fonts just to have characters displayed by the default > face's font. It shouldn't be needed, if the font really supports > those characters Except that it /is/ needed, as I've described in my original question? My default face's unicode font (DejaVu) obviously supports all the characters one could ever find in windows-1251 encoding, yet such characters are displayed in another font for text that has windows-1251 charset property imposed on it. Moreover, it seems to match the documented Emacs behavior with respect to selecting font depending on charset. Are you saying that font from default face should be used despite the charset property being set on text? Is my Emacs misconfigured or misbehaving then? Is there a knob to turn off charset-dependency of font selection algorithms? If not, does it make sense to implement one? > >> > Moreover, specifying that font for any charset is probably not >> > a good idea, since no font covers all of Unicode. >> >> Maybe I should be able to express exactly this by specifying, say, >> "preferred font" for a fontset? > > There's no such thing. That's not how fontsets in Emacs work. That's exactly my point. I was just dreaming. That said, as little as I know about fontsets, it seems to be rather simple /addition/ to the system that'd solve such kind of configuration problems. > >> Actually, I probably do want to use only this font (and have empty >> rectangles or some such in case of missed glyphs). I mean some way to >> force Emacs to behave as if this font is the only available font in the >> entire system. Still no simple way? > > Maybe there is, but I don't know how, and frankly doing that makes > little sense to me. Well, I do have font that has all the glyphs /I need/, so it'd be the simplest solution for me to just tell Emacs to only ever use that one. Simple. Fast. Fool-proof. Don't want to resort to running in text terminal configured to use this font though. Here is another example of some sense: I get GNUS summary buffer for a mixture of mails in different languages. Hieroglyphs makes zero sense to me, yet they occupy more space vertically than most of the other glyphs. I'd prefer them not to be displayed, and it happened to be rather simple when there were no UNICODE fonts (just not install fonts in corresponding encodings), but now this is quite a challenge. > Emacs was designed to display every possible character by selecting a > suitable font; forcibly displaying some characters as boxes is against > its design. Emacs is also known for its extreme flexibility and there are times when designs change... Not that I even try to insist on anything, but current design does seem to be very complex (that might well match the complexity of the problem) yet not flexible enough. It seems to make complex things possible, yet doesn't provide simple solutions for simple problems. Here is an example of a simple configuration that currently seems to be not achievable: use font specified by particular face, and never resort to anything else unless the font doesn't have needed glyph. Thanks, -- Sergey