Open Bug 1134947 Opened 9 years ago Updated 2 years ago

Ahem font shows different height for zh-TW lang on Windows

Categories

(Core :: Layout: Text and Fonts, defect)

x86_64
Windows 8.1
defect

Tracking

()

People

(Reporter: xidorn, Unassigned)

References

Details

Attachments

(2 files, 2 obsolete files)

Attached file zh-tw.html (obsolete) —
When lang is zh-TW, Ahem font behaves slightly differently than in other lang. See the attachment. You need to install Ahem font [1] before. Do we do anything special for zh-TW?

[1] http://www.w3.org/Style/CSS/Test/Fonts/Ahem/
Attached image screenshot
Blocks: 1133624
Seems to be a windows-specific problem. It works fine on Mac.
Attached file testcase (obsolete) —
Attachment #8566926 - Attachment is obsolete: true
Attached file testcase
Use https for the font file so that it can be checked directly on bugzilla.
Attachment #8569492 - Attachment is obsolete: true
Summary: Ahem font shows different height for zh-TW lang → Ahem font shows different height for zh-TW lang on Windows
The reason that this happens only on zh-TW on Windows is that, the default font list of zh-TW contains some bad underline font family. Although it is also true for ja and zh-CN fonts, the fonts in the list seem to have an larger underline offset.

The underline offset:
Ahem: ~ -2.66
First bad in ja list: -2.00
First bad in zh-TW list: ~ -3.81

in gfxFontGroup::GetUnderlineOffset(), the smaller one is peeked as the underline offset, which in case of zh-TW is -3.81.

After some further calculation, it finally adds one pixel to the descent and the height.

But simply adding descent probably shouldn't cause this problem?
Need to look at this a little closer but guessing we shouldn't be using "first font in list" logic like this.
So this problem happens in nsLineLayout::VerticalAlignFrames(), which calls nsLayoutUtils::GetCenteredFontBaseline() to calculate the minBCoord, which is later used in calculation of the baseline of the block.

nsLayoutUtils::GetCenteredFontBaseline() uses the result of nsFontMetrics::MaxHeight() which finally calls gfxFontGroup::GetUnderlineOffset().

Finally, the block outside the text of zh-TW will have a wrong baseline.

Not sure how should we fix this problem.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: