need test fonts with different underline offsets that work on all platforms




Layout: Text
8 years ago
7 years ago


(Reporter: dbaron, Unassigned)



Firefox Tracking Flags

(Not tracked)




8 years ago
When writing reftests for bug bug 523717, I generated test fonts that differ only in underline offset.  However, it seems the underline offset difference in the fonts that I generated is only honored on Linux (GTK2 port).  It's not honored on Windows or Mac.  (I was just using the fontforge python API and setting upos.)

I'm not sure what I did wrong, but it would be nice to have test fonts that actually cause underline offset to be reflected properly on all platforms, but I really don't know how to do that.

Pending that change, the relevant test is marked as failing on Mac and Windows.
This seems to be related to the code in gfxFont::SanitizeMetrics that does:

    // If underline positioned is too far from the text, descent position is preferred so that underline
    // will stay within the boundary.
    else if (aMetrics->underlineSize - aMetrics->underlineOffset > aMetrics->maxDescent) {
        if (aMetrics->underlineSize > aMetrics->maxDescent)
            aMetrics->underlineSize = PR_MAX(aMetrics->maxDescent, 1.0);
        // The max underlineOffset is 1px (the min underlineSize is 1px, and min maxDescent is 0px.)
        aMetrics->underlineOffset = aMetrics->underlineSize - aMetrics->maxDescent;

Because the MarkA font has an unusually small descent, this kicks in and munges the underlineOffset value that you tried to specify. Behavior probably varies on different platforms depending which "descent" field in the font is being used.
You need to log in before you can comment on or make changes to this bug.