[Fontconfig] [PATCH] don't artificially embolden fixed-width fonts

Adam Williamson awilliam at redhat.com
Tue Feb 10 17:37:42 PST 2015


On Wed, 2015-02-11 at 02:26 +0100, Raimund Steger wrote:
> Adam Williamson wrote:
> > It changes the width. The key thing about a fixed-width font
> > is...it's fixed width. If someone's using one, they almost
> > certainly don't want an artificial bold face that uses wider
> > characters. This is a major pain when using a text editor that 
> > uses bold face for syntax highlighting, and affects two widely- 
> > used monospace fonts which have no native bold face, Droid
> > Sans Mono and Inconsolata.
> > 
> > Refs:
> > 
> > http://askubuntu.com/questions/100672/how-to-prevent-automatic-bold-version-of-a-font-to-be-wider-than-regular-havin
> > http://lists.freedesktop.org/archives/fontconfig/2012-January/003730.html
> > https://bbs.archlinux.org/viewtopic.php?id=133256
> > ---
> >   conf.d/90-synthetic.conf | 4 ++++
> 
> I'm not sure if I like this, being an avid user of emboldened Lucida 
> Console myself.

Thanks for the feedback!

Yeah, I understand that it's a bit questionable; the patch is by way 
of being a trial balloon to draw attention to the issue.

>  Still I see the problem if people don't want it, since it's at 
> position 90 and a target=font rule, meaning people cannot really
> remove it in their user config. That's really somewhat unfortunate. 
> (Why
> is that file even at that position?)

Yeah, that's annoying. Even if you're in a position to add a rule to 
the systemwide config, I think you can't *entirely* override it, 
because the rule is basically destructive - once it's assigned weight 
'bold', you can no longer do the same match! You can have a rule like 
this:

        <match target="font">
                <!-- don't embolden fixed-width, as it changes the width -->
                <test name="spacing" compare="not_eq">
                        <const>mono</const>
                </test>
                <edit name="embolden" mode="assign">
                        <bool>false</bool>
                </edit>
        </match>

But if I understand things correctly, that will *mostly* work, but 
things that 'us[e] Xft directly' (per the comment in 90-
synthetic.conf) will still get bold. (I haven't checked this theory, 
though - in practice the above rule appears to be good enough for me).

Editing 90-synthetic.conf directly is of course possible, but will get 
overwritten by vendor updates most likely.

Honestly, though, I think poking fontconfig is a long way beyond a lot 
of folks :/ Even people who code aren't necessarily system config 
experts who grok how to poke their font rendering config, a lot of 
folks just expect that kind of thing to 'work out of the box' these 
days.

This at least doesn't affect most distros by default I don't think 
because they tend to default to DejaVu Sans Mono which has a native 
width-matched bold variant, but Droid Sans Mono is certainly popular 
(Google results bear this out) and it does not have one. I found out 
that there actually *is* a width-matched bold variant of Inconsolata, 
but it's a whole messy forking situation (the original maintainer lost 
interest and there appear to be at least two active forks of the font 
now; I'm poking the relevant folks to try and get that all 
straightened out), and most distros don't include the bold one (or if 
they do, only as part of a TeX distribution, not as a system font).

> On a side note, if you want same character widths for emboldened 
> fonts, you can typically use matrix elements. Like:
> 
>    <edit name="matrix" mode="assign">
>      <times>
>        <name>matrix</name>
>        <matrix>
>          <double>.92</double><double>0</double>
>          <double>0</double><double>1</double>
>        </matrix>
>      </times>
>    </edit>
> 
> (Above value is correct for emboldened Courier New; for Lucida 
> Console it's .96; YMMV)

Seems like an awful lot of font-specific detail :/ I am really no font 
expert - so excuse me if this is a dumb question, but would it be at 
all plausible to implement some kind of generic non-widening synthetic 
bold in freetype which it could use for fixed-width fonts, presumably 
one that just tries to thicken the lines? If so I guess that'd be the 
least impactful way to approach the problem. I definitely don't have 
the knowledge for it, though.
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net



More information about the Fontconfig mailing list