diff options
Diffstat (limited to 'content/blog/st-bitmap-font-fix.md')
| -rw-r--r-- | content/blog/st-bitmap-font-fix.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/content/blog/st-bitmap-font-fix.md b/content/blog/st-bitmap-font-fix.md new file mode 100644 index 0000000..53e6740 --- /dev/null +++ b/content/blog/st-bitmap-font-fix.md | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | +++ | ||
| 2 | title = "Fixing bitmap font fallbacks in the st terminal" | ||
| 3 | date = 2023-11-24 | ||
| 4 | draft = false | ||
| 5 | +++ | ||
| 6 | tldr, change FC_SCALABLE in x.c from 1 to 0. (comes from the font2 patch) | ||
| 7 | |||
| 8 | For some context, I have been using xterm for a long while when I'm on OpenBSD | ||
| 9 | since it is included by default in Xenocara with Terminus as my default font, | ||
| 10 | and the main reason why I did not use st again was that my bitmap fallback font | ||
| 11 | for CJK was not loading. Instead, I get an ugly sans-serif scaled font that | ||
| 12 | looked very out of place in my otherwise clean and crisp bitmap terminal. | ||
| 13 | |||
| 14 | Yes, I did make sure that the font2 patch for st was applied correctly. | ||
| 15 | |||
| 16 | The X11 font string for reference is Fixed: | ||
| 17 | -misc-fixed-medium-r-normal-ja-18-120-100-100-c-180-iso10646-1 | ||
| 18 | |||
| 19 | It also didn't help that fontconfig was unable to find the font either no | ||
| 20 | matter how much I looked for it with fc-list and fc-match. The weirder thing is | ||
| 21 | that when I installed GNU Unifont to my fonts directory, fontconfig was able to | ||
| 22 | find it and st loaded it (I put a printf in the xloadfonts() function in x.c), | ||
| 23 | but the same old ugly scaled font was still being shown for CJK. The weirderer | ||
| 24 | thing was that Unifont was rendering just fine when being used as the main font | ||
| 25 | instead of in font2. | ||
| 26 | |||
| 27 | I thought to myself why this was happening and wasn't able to find out, until I | ||
| 28 | reread the font loading portion in x.c's xloadsparefonts() function that came | ||
| 29 | part of the font2 patch. | ||
| 30 | |||
| 31 | It had set the FC_SCALABLE boolean to 1 (true). That explained why the fallback | ||
| 32 | font rendered fine as the main font and not fallback. Setting that boolean to | ||
| 33 | 0 (false) fixed my fallback font not matching issue, and now I have clean and | ||
| 34 | crisp looking text that I can read more easily. | ||
| 35 | |||
| 36 | I already disliked fontconfig, freetype, xft, and friends (don't get me started | ||
| 37 | on pango and harfbuzz), but this incident made me dislike it further. | ||
