Re: [dev] [tabbed] utf8 characters not displayed in tabs

From: Storkman <storkman_AT_storkman.nl>
Date: Tue, 30 Aug 2022 22:47:46 +0200

On Tue, Aug 30, 2022 at 10:23:44PM +0600, NRK wrote:
> On Tue, Aug 30, 2022 at 05:36:31PM +0200, Hiltjo Posthuma wrote:
> > "
> > The font fallback in dwm and dmenu is handled via libsl (i.e drw.c) and
> > it's a huge mess [0].
> >
> > The way it works is also very inefficient (it calls XftFontMatch() for
> > every single "unknown" code-point). The `nomatches` cache is merely
> > there to stop the bleeding and is not really a proper fix.
> > "
> >
> > This part specificly. The tone if very whiny.
>
> I see; the intention there was to just describe/explain why I think
> replicating drw is not a good idea. It wasn't meant to be whiny.
>
> > It doesn't help complaining the code is a mess or improper without
> > proposing a patch.
>
> The "proper" way (IMO) would be to build up a list of fonts which would
> be capable of representing as many code-points available in the system
> *right at startup* - instead of checking each unknown code-point as we
> go.

I'm a big fan of pre-calculating this list before compiling the program.

> This way if the code-point cannot be found within the list; we'll know
> right away that it's a missing glyph and there won't be any need to call
> XftFontMatch for each "unknown" code-point.

In my text editor, I just use a static pre-configured list of font names.
It's very efficient, since there's only like four of them, and Xft keeps
a bitmap of supported code-points in every loaded font.
I can define exactly which fonts I want it to use without ever delving
into the FontConfig XML Hell again.

I suppose it's a difference in interpretation of what the "correct" behavior is.

> The problem is, as I said, I'm not sure if it's even possible/feasible
> with Xft/FontConfig as I'm not very familiar with those libraries. If
> someone knows the answer, then feel free to speak up.

There's the 'lang' and 'charset' properties, but more generally,
the "set of fonts covering as wide variety of code-points as possible"
...is just the set of all installed fonts, isn't it?
What exactly are we looking for here?

If your question is simply "which code-points ARE NOT supported by ANY font",
you could just iterate over all fonts and OR their charsets together.

    $ time fc-list '' fullname charset >/dev/null
        0m00.06s real 0m00.05s user 0m00.01s system

> If it is possible and someone can point out which routines I should be
> looking at then I can try to take a crack at it. In case that's not
> possible, then there's probably not a whole lot that can be done about
> the situation.
>
> - NRK
>

 - Storkman
Received on Tue Aug 30 2022 - 22:47:46 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 30 2022 - 22:48:40 CEST