<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Synthetic emboldening of monospace fonts makes characters wider"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=92756">92756</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Synthetic emboldening of monospace fonts makes characters wider
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>cairo
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>freetype font backend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>david@freetype.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>adamw@happyassassin.net
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>cairo-bugs@cairographics.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Earlier this year I noticed a problem with fonts in gedit. Even though I use a
monospace font, sometimes the alignment seemed to be wrong - character 76 on
one row was not at the same point horizontally as character 76 on another row.
This is obviously bad when you're writing code.

Turns out this happens when you're using a font that doesn't have its own bold
variant. For such fonts, bold characters are 'synthesized', ultimately by
freetype. When freetype does this under the control of cairo, it doesn't keep
the emboldened characters to the same width as the non-bold characters, so once
a line has any bold characters in it (gedit uses them for source highlighting),
its alignment will be wrong.

I first reported this upstream to fontconfig and freetype. Raimund Steger from
fontconfig submitted a patch to freetype which would have it maintain the
advance width when emboldening monospace fonts, but Werner Lemberg from
freetype rejected it:

<a href="https://lists.gnu.org/archive/html/freetype/2015-02/msg00040.html">https://lists.gnu.org/archive/html/freetype/2015-02/msg00040.html</a>

saying that in his opinion, it should be fixed at the toolkit level, e.g. in
Cairo and in Qt. So, I'm reporting it here.

Raimund had an interesting follow-up here:

<a href="http://lists.freedesktop.org/archives/fontconfig/2015-February/005401.html">http://lists.freedesktop.org/archives/fontconfig/2015-February/005401.html</a>

where he noted that "even plain old XftDrawStringUtf8 seems to do a better job
than .. er, these toolkits. (I think it uses XftFont's max_advance_width to
determine spacing for fixed-width fonts which is unaffected by the individual
FT_GlyphSlot_Embolden results.)"

It's pretty easy to reproduce this problem: run gedit, set the font to Droid
Sans Mono, and open a file in some syntax gedit can highlight, a Python file,
an RPM spec, anything. Compare the rendering of lines with boldface and lines
with none.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>