Font Fallback - Desktop Customization & Workflow
Users browsing this thread: 3 Guest(s)
|
|||
My programs use Xft and I have to implement font fallback myself, I used suckless software as a base but tried to simplify their code. I ended up writing a function that, given a character, tries to find a font that supports it: here it is.
Suckless code for doing that is completely spaghettish and unreadable. I tried to do my best. In the end it works the same, but with a saner algorithm. I splited Suckless' drw_text() function into three functions: drawtext(), getfontucode() and getnextutf8char(). First it searches among the fonts the user listed in the configuration, and then it searches the system for a font that contains a given character. I first tried to use pango, but then decided to study more how font fallback is done and then could implement myself. If you try, for example, a CJK glyph on xmenu or xprompt, they will do their best to find a font that support it. I never needed to change fontconfig, except for setting my default monospaced font. The problem is when the font contains a colored emoji, then, due to a strange Xft bug, the program crashes, depending on the system you are. There are some patched versions of libXft in some distros. Here in OpenBSD the program just don't render the colored emoji. But on most Linux systems the program crashes. |
|||
Messages In This Thread |
Font Fallback - by venam - 11-08-2020, 04:35 AM
RE: Font Fallback - by z3bra - 11-08-2020, 04:51 AM
RE: Font Fallback - by movq - 11-08-2020, 07:00 AM
RE: Font Fallback - by venam - 11-08-2020, 08:26 AM
RE: Font Fallback - by movq - 11-08-2020, 11:02 AM
RE: Font Fallback - by seninha - 16-08-2020, 06:39 PM
RE: Font Fallback - by venam - 17-08-2020, 02:30 AM
|