help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to enforce unicode font for all charsets?


From: Robert Pluim
Subject: Re: How to enforce unicode font for all charsets?
Date: Wed, 11 Mar 2020 09:17:12 +0100

>>>>> On Wed, 11 Mar 2020 08:10:39 +0300, Sergey Organov <address@hidden> said:

    Sergey> Thanks, I was thinking along these lines indeed. The problem is I 
can't
    Sergey> figure how exactly do I do it, provided the DejaVu Sans Mono is the 
font
    Sergey> currently being set through M-x customize-face RET default, and I 
don't
    Sergey> want to loose the ability to change this way the (only) font I'd 
like to
    Sergey> use.

    Sergey> I mean, it looks like I need to modify fontset-auto1, as M-x
    Sergey> describe-fontset RET shows:

    Sergey> Fontset: -PfEd-DejaVu Sans 
Mono-normal-normal-normal-*-23-*-*-*-m-0-fontset-auto1
    Sergey> [...]

    Sergey> and after some more digging, I finally tried:

    Sergey> (set-fontset-font "fontset-auto1" 'windows-1251
    Sergey>   (font-xlfd-name (face-attribute 'default :font))

    Sergey> which evaluates to:

    Sergey> "-PfEd-DejaVu Sans 
Mono-normal-normal-normal-*-23-*-*-*-m-0-iso10646-1"

You'd want to use nil instead of "fontset-auto1" to affect the current
frame's fontset, or t to affect the default fontset.

    Sergey> but doesn't seem to have any visible effect. And even if that 
worked, it
    Sergey> wouldn't immediately pick subsequent customization of the default 
face
    Sergey> anyway?

Right, fontsets are static. How often do you customize your default
face? :-)

    Sergey> What do I miss?

    >> Moreover, specifying that font for any charset is probably not
    >> a good idea, since no font covers all of Unicode.

    Sergey> Maybe I should be able to express exactly this by specifying, say,
    Sergey> "preferred font" for a fontset? I mean: "use this font, unless 
there is
    Sergey> no suitable glyph, in which case turn back to the fancy methods of
    Sergey> considering charsets".

By default, set-fontset-font replaces the existing definition. You can
pass it 'prepend' as the fifth argument to have it add to the front of
the existing one.

    Sergey> Actually, I probably do want to use only this font (and have empty
    Sergey> rectangles or some such in case of missed glyphs). I mean some way 
to
    Sergey> force Emacs to behave as if this font is the only available font in 
the
    Sergey> entire system. Still no simple way?

For all characters or just the windows-1251 charset? If the latter

(set-fontset-font t 'windows-1251
                  (font-xlfd-name (face-attribute 'default :font))

should do that.

Robert



reply via email to

[Prev in Thread] Current Thread [Next in Thread]