Custom Fonts in Clear Linux

I’m having some difficulty getting certain custom fonts to render properly in Gnome 3 on Clear Linux. Particularly vexing is the font “IBM Plex Sans Text”, a font I’ve kinda fallen in love with for my UI on Fedora. I can’t seem to get the font to render the same way on Clear as it does on Fedora, particularly for Gnome Shell. On Fedora, it has a nicely styled, compact spacing that’s readable yet doesn’t take up too much space. When I try to use it on Clear however, all the letters space out almost as bad as a Mono font, just barely a step away from a Courier or a Typewriter style. It’s not truly monospaced, but it looks almost as bad. I can get another font of the same family, “IBM Plex Sans” to render almost exactly the same between the two, but the Text variant is driving me up the wall. I’ve tried playing around with fontconfigs, letter-spacing and kerning and font features in the css for gnome-shell, but everything I’ve tried gives me the same result.

Does anyone have any thoughts as to what I can do to get Clear to render these fonts the same as in Fedora 31? Is it possible to attach small images for examples to a topic?

Thanks!

You can attach images to forum posts. There’s an Upload button in the editor, that looks like a little painting. Sort of like this: :framed_picture:

Thanks @ahkok!!

This is what I’m seeing in Fedora and Clear Linux:


Fedora 2
Clear 2

I tried this out myself and here is what I see.

I made the font bigger so I could see that it got applied.

I don’t have Fedora to easily compare to. It is really hard for me to tell if the font spacing is a little wider or not. It doesn’t look like a mono font to me but it might be rendering slightly wider but certainly not mono space in my case.

Edit: I am using Clear Linux 31950

1 Like

@eadams It’s not so much when you’re using it as the application font as it is when you’re using it as the gnome-shell font. I create my own theme that @imports the Materia theme, then makes only one change to it, setting the font-family for stage in gnome-shell.css to IBM Plex Sans Text. That’s when you see the oddball spacing occur, in the panel most visibly. The same behavior doesn’t occur in Fedora. I’ve tried using IBM Plex Sans (without the “Text”) but there’s something about that Text variant that just looks better. I think it handles being bold a little better.

I don’t see it render as monospace - I mean, the i is clearly spaced much thinner in the screenshots.

I do indeed see that the spacing is very different than on Fedora. I honestly myself would prefer the clearlinux font as it appears to be more readable (to me, personally) due to the more consistent spacing.

No answer why it is different. The only logical explanation would be that we’ve either tuned some settings or we’re running newer versions of involved libraries.

You can also finely tune various font display parameters through the various libraries yourself, this may be a good solution because it would possibly work with all fonts. Look into this: Font configuration - ArchWiki.

I have been spinning my wheels, trying to get this font to render the same way in Clear as it does in Fedora, but I’ve only managed to give myself a headache at this point. Every time I think I’m close to figuring it out, I fail. I tried changing fontconfig settings, even copying fontconfig settings from Fedora, but that doesn’t seem to help. In fact, except for a few settings in Gnome Tweaks and the custom CSS for the gnome-shell, nothing I try seems to even affect gnome-shell. I keep thinking either I need to find a setting I’m not seeing in Gnome itself to affect this, or maybe it has something to do with the freetype interpreter, but I haven’t figured out where to change that either.

It’s just the font spacing in Gnome Shell seems odd, uneven, too wide and unnatural compared to Fedora using the specific “IBM Plex Sans Text” font.

If anyone knows where there might be hidden settings in Gnome / Gnome Shell that may affect font rendering, or can tell me how I can change which type interpreter the system is using, I would greatly appreciate it. Otherwise, I may have to find another favorite UI font…

By the way, when last I looked, the one noted difference I did find is that Clear is using Freetype 2.10.1 while Fedora 31 was using 2.10.0, which could mean that this is just a happy accident that’s going to be wiped out in Fedora 32 anyways.

Thanks!

Just to give you an update, I decided to try and throw the IBM fonts into Windows, treating it as the Gold Standard that the fonts were probably created to be used with, and it left me somewhat flabbergasted. If the Windows rendering is treated as the correct one, Clear’s rendering is closer to correct than Fedora, and both Clear AND Fedora look better than Windows.

At this point, I’m just going to shake my head and move on.

Okay, so I’m like a dog chasing after the mail truck. I’ve been doing more reading about font rendering in Linux and Fedora specifically and doing some more testing. What I’ve discovered:

Fedora 30, Ubuntu 19.10 and Clear Linux ALL render IBM Plex Sans Text the same way. This particular rendering seems unique to Fedora 31.

If I’m reading the blogs and bug notes right, Fedora 31 started using a library called Harfbuzz for its font rendering and shaping in the UI. Apparently it’s something they’ve been compiling into programs like Firefox for a little while now.

I’m far from certain about what I speak, as a disclaimer, because I’m cobbling information together from bits and pieces instead of a full explainer. However, would it be possible to enable Harfbuzz in Clear Linux from the user side? Or would that require patching and recompiling packages provided that would probably get overwritten with the next OS update to Gnome / Pango / etc.?

According to this
https://fedoraproject.org/wiki/Features/Harfbuzz
Harfbuzz reduces memory consumption, and I’m interested in this.

We already have harfbuzz available.

But I’m not sure how much it is integrated to the system.

Yes, that’s what I’m curious about as well. While it’s available, does the Gnome UI or its underlying packages make use of it in Clear Linux like it’s being used in Fedora? Can we enable it on our end through configuration, or does it necessitate patching and recompiling packages that would be better done on the repository side?

I think I’ve pinned down the source of the (my?) font issue to an upgrade in Pango, documented in the Phoronix news blurbs I’ve linked below. TL;DR: Looking at Clear Linux, Build 31990 is currently using the pre-Harfbuzz Pango 1.42.4. Fedora 31 is currently using Harfbuzz-enabled Pango 1.44.7.

It sounds like the change to Harfbuzz in Pango is causing some consternation in some corners of the community due to the elimination of older bitmap fonts. Does this mean that Clear Linux might stay with the older Pango for a while, or will they upgrade to the latest Pango at some point given that it doesn’t appear they’re going to be backing out the changes? How soon until we might see the upgrade to Pango 1.44?

Thanks!

Pango 1.44 Is Coming Thanks To The Revival By GNOME Developers

GNOME’s Pango 1.44 Released With Many Text Rendering Improvements

Pango Dropping Support For Bitmap Fonts Is Frustrating Some Linux Desktop Users

1 Like

Maybe GitHub is a better to report this kind of problems.

Upgrade request submitted to GitHub! Thanks, @doct0rHu!!

1 Like

I saw that. Thanks for reporting

I just wanted to give a big shout out to the Clear Linux team for solving this problem and upgrading the Pango package! Thank you!!!

4 Likes

As of the init process for chrome’s internal fontconfig for not finding our confs, I’m on a blindspot here.

I tried with a fonconfig in $XDG_CONFIG_HOME/.config/fontconfig/conf.d which forces the load of our configs in /usr/share/defaults which works, but it’s a rather ugly hack that I’d prefer to avoid ;-(

this is what I’ve used fwiw:

% cat ~/.config/fontconfig/conf.d/50-chrome-legacy.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
	bad google-chrome is the only one who does not honor
	fontconfig stateless (statically linked version?)

	so we ough to "workaround" with this ugly hack ;-(
-->
<include ignore_missing="yes">/usr/share/defaults/fonts/conf.d</include>
</fontconfig>
4 Likes

This is the only thing that worked! Thank you!