Glyph advances are not pixel aligned with HarfBuzz shaping

RESOLVED DUPLICATE of bug 605043

Status

()

RESOLVED DUPLICATE of bug 605043
8 years ago
8 years ago

People

(Reporter: karlt, Assigned: karlt)

Tracking

({regression})

Trunk
x86_64
Windows XP
regression
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(blocking2.0 final+)

Details

Attachments

(2 attachments)

(Assignee)

Description

8 years ago
Layout does not align text to pixel boundaries, so, with font drawing backends
that snap glyph positions to pixels (ft, win32 [gdi] - any others?), it is
important that inter-glyph spacing within words is always an integer number of
pixels.  This ensures that the drawing backend snaps all of the word's glyphs
in the same direction and so inter-glyph spacing remains the same.

With harfbuzz shaping enabled, the inter-glyph spacing is not always integer,
which results in sometimes adjacent glyphs getting pixel-snapped in opposite
directions, changing the inter-glyph spacing by almost +/- 1 pixel.  I suspect
the non-integer spacing is coming from the kerning.
(Assignee)

Comment 1

8 years ago
Created attachment 487492 [details]
testcase

This testcase needs DejaVu Sans installed.

Expected results: "burn fox" at all three text positions.
Actual results: At one text position, it looks like "bum fox".
Also the "ox" spacing is too close on the first line.
(Assignee)

Comment 2

8 years ago
The bug already exists on MS XP (and, I assume, other systems using win32/GDI).
This needs to be resolved for bug 569770 because DejaVu Sans is the most
commonly used font on Linux systems and is the UI font on most Linux systems.
blocking2.0: --- → ?
Keywords: regression
(Assignee)

Comment 3

8 years ago
It would probably usually be enough to just touch up the kerning adjustments
but it probably makes more sense to do the rounding on the final hb-calculated
advance in gfxHarfBuzzShaper::SetGlyphsFromRun (for font-backend/surface
combinations that snap to pixels).
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxHarfBuzzShaper.cpp#1012

That way plain glyph metrics (for unhinted fonts) would not need rounding
until after kerning is applied, and I guess there could also be other
non-integer adjustments applied by the shaper.
(Assignee)

Comment 4

8 years ago
Created attachment 487521 [details]
screenshot
(Assignee)

Updated

8 years ago
Assignee: nobody → karlt
(In reply to comment #3)
Is this related to Bug 605043 (using Tahoma Font)?
Will this fix it, too?
(Assignee)

Comment 6

8 years ago
Looks like the same bug, thanks.
Blocks: 575695
No longer blocks: 569531
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 605043
blocking2.0: ? → final+
You need to log in before you can comment on or make changes to this bug.