[Fontconfig] How to prevent Chromium from scaling bitmapped fonts?

Raimund Steger rs at mytum.de
Sat Mar 12 15:08:25 UTC 2016


On Sat, 12 Mar 2016 15:04:27 +0100
Raimund Steger <rs at mytum.de> wrote:
> [...]
> FC_DEBUG tells me that Chromium first looks up Terminus with FcFontSort. Afterwards, the pixel size from the CSS is looked up with FcFontMatch but the result isn't used; what's used is the upscaled 12px version. That's really weird. I think I need some more time to figure out what's going on here.

OK I've now looked at the source and I think I get it.

In Chromium's world, different font sizes can't differ in font file but only in rendering settings. That's what the FcFontMatch is for.

This means you could only get around it by using a TTF wrapper that contains all of your sizes in one file.

I. e. download the Terminus source and use:

  fonttosfnt -o terminus.ttf *n.bdf
  fonttosfnt -o terminus_bold.ttf *b.bdf

Copy the resulting TTFs somewhere where fontconfig finds them.

You might then have the problem that Chromium doesn't prefer the TTFs and still lands on the PCFs. I think you could at this point get rid of the PCFs as most apps will do fine with the TTFs. The more conservative approach could be to apply a rule that assigns fontformat=TrueType to the pattern if prgname=chromium.

Raimund



-- 
Worringer Str 31 Duesseldorf 40211 DE  home: rs at mytum.de
+49-179-2981632 icq 16845346           work: rs at interface-ag.de


More information about the Fontconfig mailing list