Open Bug 1213583 Opened 9 years ago Updated 2 years ago

line-height jumps to 1.2 rather than font's 1.0 at certain round sizes of downloadable font with 0 internal and external leading

Categories

(Core :: Graphics: Text, defect, P3)

41 Branch
defect

Tracking

()

People

(Reporter: nvale, Unassigned)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(2 files)

1.06 KB, application/zip
Details
9.42 KB, image/gif
Details
Attached file test.zip
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0
Build ID: 20150929144111

Steps to reproduce:

Create font with the following metrics:
Units per EM = 2000
Ascender = 1800
Descender = -200
LineGap = 0
TypoAscender = 1800
TypoDescender = -200
TypoLineGap = 0
WinAscent = 1800
WinDescent = -200
XHeight = 1000
CapHeight = 1400

Font must contain at least one glyph.

Embed font with @font-face and display any existing glyph.



Actual results:

line-height is abnormal (very large) at certain font sizes, for example: 40px, 80px, 100px, 200px.

For example: 
At font size = 201px the line-height is 201px. 
At font size = 200px the line-height is 240px. 




Expected results:

line-height should be normal size at all font-sizes.
Summary: line-height is abnormal on certain sizes of embedded font. → line-height is abnormal at certain sizes of embedded font.
Attached image Image.gif
Screenshot
Flags: needinfo?(nvale)
Flags: needinfo?(nvale)
Component: Untriaged → Layout
Product: Firefox → Core
Reporter, I'm curious if you see the same result if you go to about:config, change the preference browser.display.normal_lineheight_calc_control, from its initial value of 2, to 1, and restart the browser?  I suspect the behavior will go away, but it would be good to confirm.

I don't see the problem on Linux; I see the 240px line-height in both cases.

This is because, by default, the function GetNormalLineHeight in layout/generic/nsHTMLReflowState.cpp replaces the font-provided leading with 1.2 if there is neither internal nor external leading.  I suspect that on Windows something related to rounding is causing there to be a very small nonzero amount of leading at some font sizes, but not at particularly round ones.

I guess there are two questions:
 (1) whether we do want to retain that defaulting-to-1.2 behavior
 (2) whether we can fix the rounding issue, or whether it needs some tolerance around 0.
Component: Layout → Graphics: Text
Flags: needinfo?(nvale)
Summary: line-height is abnormal at certain sizes of embedded font. → line-height jumps to 1.2 rather than font's 1.0 at certain round sizes of downloadable font with 0 internal and external leading
(In reply to Michelle Funches - QA from comment #2)
> @Reporter - are you still experiencing this issue? Have you applied Firefox
> update 42.0?

Firefox 42.0 has the same issue.
Flags: needinfo?(nvale)
(In reply to David Baron [:dbaron] ⌚UTC-8 from comment #4)
> Reporter, I'm curious if you see the same result if you go to about:config,
> change the preference browser.display.normal_lineheight_calc_control, from
> its initial value of 2, to 1, and restart the browser?  I suspect the
> behavior will go away, but it would be good to confirm.

I have changed "browser.display.normal_lineheight_calc_control" from 2 to 1, restarted the browser and got normal line-height. I confirm you are right, the behavior go away!
This sounds a lot like the Mac OS X issue described in bug 832313, where we have a similar situation where rounding sometimes results a calculated leading of zero, and hence the 1.2 factor kicks in.
See Also: → 832313
I wonder if we should not use the use-1.2-instead code if the font is downloaded rather than from the system.
Whiteboard: [gfx-noted]
Still exists in version 46... :(
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: