emacs-devel
[Top][All Lists]
Advanced

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

Re: Suggest installing more fonts?


From: Eli Zaretskii
Subject: Re: Suggest installing more fonts?
Date: Sat, 17 Oct 2020 21:50:43 +0300

> Date: Sat, 17 Oct 2020 18:36:47 +0000
> From: Gregory Heytings <ghe@sdf.org>
> cc: larsi@gnus.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org
> 
> >> I don't (yet) know, but I'd be surprised if this could not be done. 
> >> Emacs already creates glyphs dynamically for tofus
> >
> > No, Emacs doesn't create any glyphs dynamically for tofus, it simply 
> > uses a smaller font in a box it itself draws.  See 
> > xterm.c:x_draw_glyphless_glyph_string_foreground for how this is done on 
> > X (w32 and ns do it very similarly).
> 
> Yes, but Emacs draws the box itself, and I suppose that if it can draw a 
> box, it could instead draw a small black-and-white (8x16 or 16x16) bitmap. 
> Emacs already does this for fringe bitmaps AFAIU.

But the "bitmap" in this case is a font glyph.  So to get at that
glyph, we would need to have the code that is already in the library
we use for accessing fonts, is that what you have in mind?  So we'd
need to have the code which understands how font files are structured,
and how to find in them the glyph(s) for a certain character given
that character's codepoint, and how to know whether the font has a
glyph for that character to begin with?

For example, look at xftfont_open, which is one implementation of how
to open a font.  Count the number of functions and variables whose
names begin with "Fc" -- those are references to the Fontconfig
library.  Under your proposal, we'd need to implement all that in our
own code, is that right?

> >> The proposal is not to change anything to the way Emacs uses fonts, but 
> >> to change something to the way Emacs behaves when it does not find an 
> >> appropriate font to display a character.  In that case Emacs would 
> >> display a "degraded" glyph (from Unifont), and would issue a warning 
> >> that the user should install another font.
> >
> > I don't see how this can be done without serious changes in the code 
> > that finds and uses fonts.  We _need_ the Fontconfig functionality.
> 
> With the proposal, there is no need to find the font, it is already 
> included, and only used as a fallback when no appropriate font has been 
> found.  Unifont is just a long sequence of small bitmaps, Emacs only has 
> to pick the bitmap corresponding to a given character in that list and to 
> draw it.  For example, the character "A" in Unifont is the 8x16 bitmap 
> "0000000018242442427E424242420000" which occupies only 16 bytes.

So we will code a special font "backend" that is tailored to what
Unifont has in its files now, and on top of that support this only for
a single size of the default font, i.e. no support for "C-x +", no
support for specifying a different size in default-frame-alist, etc.?
And then we will have to maintain this code when Unifont changes
something in its files?  I'm sorry, but this makes very little sense
to me, especially with an ugly font such as Unifont.



reply via email to

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