On 2022-10-15 10:49, Sander Jansen wrote:
> (this is regarding the fontconfig / Xft backend)
>
> How can we deal with dual spaced fonts effectively? Right now, when
> trying to find a FXFont:Fixed type fonts occasionally get these weird
> doubled wide character spacing:
>
> Apparently this is solely based on whether the Fixed flag hint has
> been passed. In all 3 cases, it finds the exact same font.
>
> The current implementation uses the FC_MONO flag whenever we pass
> FXFont::Fixed. Apparently fontconfig also has a FC_DUAL flag (it seems
> to allow for multiple fixed sizes in a font), which seems to work
> better in this particular case:
>
> (in a typical user interface, having mixed width characters like the
> above is pretty rare of course)
>
> So i've been wondering whether we should be using the FC_DUAL hint
> instead of FC_MONO. It certainly seems to behave much better from an
> end-user perspective (and does not require them to have a PHD in
> fontconfig nightmares).
>
> Thoughts?
OK, this is 2 steps:
1) Added new FXFont hint flag, FXFont::Dual. Needless to say, this
is translated to FC_DUAL in interactions with FontConfig.
2) FXFont's new Dual flag means the other hints have shifted up a bit;
I figure its OK as the other hints are not often passed; besides,
you should be referencing them symbolically.
However, FXFontDesc::setFont() and FXFontDesc::getFont() deal with
the hints as an integer; here we may perhaps run afoul; its going
to be rare as the hints are to limit matching, not so much used in
determining the actual font [where all the bits have typically been
filled in].
3) Its going to take some doing to update FXText to deal with dual-
width fonts. It can be treated as proportional [which would disable
block-selections], or maybe as a special mono.
In the former case, no special mods are needed to FXText other than
to
treat FXFont::Dual as if it were proportional. In the second case,
which is of course preferred, we may want to look over width
calculations
carefully, in particular counting wide characters as two columns.
Needless to say, the latter approach will require a lot more work...
I believe FXFont::isFontMono() currently returns TRUE if the 'i' is
as wide as the 'm'. We should be doing something more sophisticated
than this...
-- JVZ
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.