Re: Fixed Type Fonts - FC_DUAL or FC_MONO
Jeroen van der Zijp <[email protected]>
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Organization | FOX Toolkit |
| Message-ID | <20221018000107.39f53c3c@leviathan> |
On Sat, 15 Oct 2022 10:49:41 -0500 Sander Jansen <[email protected]> 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: > >[image: FC_MONO.png] > >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: > >[image: FC_DUAL.png] >(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? Thoughts: 1) I have not tries this, but can one pass multiple FcPatternAddInteger(pattern,FC_SPACING,FC_MONO); calls to pass the equivalent of an "or" in the matching process? 2) I can confirm XLFD still works properly. 3) Made some changes [we're probably not done with it yet], but here's the scoop: 1) We split the single option FXFont::Fixed into two flags: FXFont::Fixed = FXFont::Mono and FXFont::Cell. 2) Windows. It differentiates between FIXED_PITCH and MONO_FONT. As I understand it, FIXED_PITCH more-or-less corresponds with FXFont::Cell, and MONO_FONT with FXFont::Mono. As a rule, when I want Mono, I should be happy to receive Cell also. 3) Xft. We can pass FC_PROPORTIONAL, FC_MONO, FC_CHARCELL, or FC_DUAL. The last one corresponds to the new FXFont::Dual. 4) XLFD has been updated: the XLDF string contains indication of cell vs. mono or fixed. We now map the cell to FXFont::Cell instead of mapping both 'm' and 'c' to Fixed. When matching, we apply weights to the effect of penalizing mono and cell, as follows: a) If we want Mono, we're have Mono, we're happy. b) If we want Mono, and have Cell, we're slightly less so. c) If we want Mono, and have neither, we're unhappy. A similar logic applies to Cell matching. 4) FXFontSelector favors the Mono+Cell combo in lieu of Fixed. We added Cell and Dual as separate options. Order in the list was changed to put anticipated choises up front. 5) It may require further testing, but its not impossible to combine Mono, Cell and Dual into the Fixed option. If that is done, it will only matter on Xft, Windows and XLFD won't care. On Xft, we may then pass FC_DUAL, and step down from there to Mono and then Cell. The double-column characters tend to be outside the common text plane and probably minor updates to FXText will be sufficient to deal with it. ------- Dropped new snapshot for those willing to play... -- JVZ -- +----------------------------------------------------------------------------+ | Copyright (C) 23:40 10/17/2022 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+