Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a monospaced font (PT Mono) that I prefer to use in programming IDE's. The font has only Regular, all other Bold and Italic are derived by slanting and "boldification" of the Regular. The problem is that the "boldified" characters are wider than regular ones, so the source code strings in the IDE window are now composed of non-monospaced characters.

How do I control the "boldification" of the font so it would not become wider than regular?

The problem is illustrated on the screenshot below (PT Mono, no dedicated bold). See how "unsigned char" and "sizeof" words are moving out from their proper positions.

automatic boldification changes the width

Here an another example, Droid Sans Mono (no dedicated bold). enter image description here

And here an example when the font has dedicated bold version (Liberation Mono). Bold and regular are aligned perfectly. enter image description here

So, the issue is definitely in frivolous boldification rendering in situations where bold is not provided. The font engine is to blame.

UPD: There is a file /etc/fonts/conf.avail/90-synthetic.conf which if being referenced from /etc/fonts/conf.d/ tunes the font engine to perform synthetic emboldening of the fonts that do not have the bold version. If the symbolic link to this file is removed from the /etc/fonts/conf.d/, the emboldening disappears. This is not what is exactly wanted, but at least this cures the case of monospace fonts being not monospace (see below, PT Mono). The fine tuning of the emboldening is still wanted (either by configuration file, or by freetype2 patch.

enter image description here

share|improve this question
    
You can't control that. Font design would be ruined. Even if you precisely reduce size (which you can't) to match regular font spacing, then bold font would look smaller. If you want uniformly spaced font, just don't use bold font... or try terminal –  zetah Feb 2 '12 at 6:14
    
That's not true. Fonts that have both regular and bold typefaces provided in separate files have same char width in regular and in bold. For example, LetterGothic. –  mbaitoff Feb 2 '12 at 6:52
    
I stand corrected. I noticed the same using SciTE (and perhaps you too use Scintilla based editor - perhaps Geany?) while my font is Droid Sans Mono, but I took it as granted, and I didn't have an idea that weighted font can have different spacing even for monospaced fonts, while bold font uses same spacing as regular. Even more it seems that also proportional fonts have this "feature" you noticed, thou not all. Sorry for my bold first reply, I should have checked first –  zetah Feb 2 '12 at 7:23
    
@zetah: I looked thru different font files and looks like that indeed the change of the width only happens when there's no dedicated bold version of the font. I'm going to update the question with more screenshots. –  mbaitoff Feb 2 '12 at 9:29
1  
mentioned also here: bugs.launchpad.net/ubuntu/+source/ttf-droid/+bug/565393 –  zetah Feb 2 '12 at 20:41
add comment

1 Answer

up vote 5 down vote accepted

mbaitoff, I'm posting this as addition to your update, not as an answer

If user creates file named ~/.fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="font">
        <test name="spacing" compare="eq">
            <const>mono</const>
        </test>
        <edit name="embolden" mode="assign">
            <bool>false</bool>
        </edit>
    </match>
</fontconfig>

then, applications can use bold monospaced font if available, and disable "synthetic boldification" if used font does not have bold typeface.

It is just alternative, and slightly different approach with different result

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.