Comment 24 for bug 1001033

Revision history for this message
Steve White (stevan-white) wrote :

Hi Weeble,

First, I want to re-iterate that this is not a FreeMono issue. We saw the same effect using Sam's script on Courier New, and using the script I provided, showed the same effect happening in several monospace fonts, including DejaVu Sans Mono.
It happens with *all* of them -- Sam's first code just happened to pick out FreeMono.

It is good you have clarified for yourself, that the base renderer produces different values. (You should also confirm that it does this with all the other Mono fonts.)

I don't know much beyond this as to what algorithm is applied by each renderer.

The advance width is a specified number, which ought to be involved in the overall placement of letters in a string.
After that, the letters are rendered. Just which pixels are colored in this process is a very complicated question.

Depending on the antialiasing algorithms applied, hinting (and TrueType instructions) can definately have an effect.
Yes, FreeMono (as packaged on the GNU FreeFont site) is hinted and instructed.

I too don't understand the numbers being returned by some of these libraries, but (for example) the remark in your code "inconsistent hinting" leads me to think you haven't sorted out the notion of the glyph description as in the font file, vs the rendered graphic produced by the font renderer. (Maybe the authors of some of these libraries hadn't thought that through either.)

The point is: what makes you think that the renderer should preserve the width of each letter?
In what sense is it to be preserved, in light of rounding, etc?
This is not a rhetorical question: where is the documentation that explains this?

You know, renderers will do many tricks, such as making pixels lighter between letters to make them more distinct. What is the "width" of a rendered letter? The distance between the outermost pixel colored? Some rounded fraction of the advance width? And my question before: should the width of a string then be a multiple of the rounded fraction obtained for a single character, or (the number of characters in the string) * (advance width) / (size factor). The two would give different values, you see.

It's a messy question.