incorrect positioning of some glyphs in vertical text when using 'vmtx' table for glyph advances

RESOLVED FIXED in mozilla38

Status

()

Core
Graphics: Text
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

(Blocks: 1 bug)

unspecified
mozilla38
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

3 years ago
Testcase using the TakaoPGothic font:[1]

data:text/html;charset=utf-8,<div style="writing-mode:vertical-rl;font:36px TakaoPGothic">A「X」Z

Note that the vertical variants of 「 and 」 are half-width characters; but the vertical 「 glyph renders incorrectly, overlapping the following X. This is because we use the advance from 'vmtx', but use a default vertical origin that assumes fixed vertical advances.

The issue is that the HBGetGlyphVOrigin callback does not return the correct Y coordinate for the origin when a 'vmtx' table is present. According to [2], "The y coordinate of a glyph's vertical origin is specified as the sum of the glyph's top side bearing (recorded in the 'vmtx' table) and the top (i.e. maximum y) of the glyph's bounding box." So that's what we should implement.

[1] Commonly present on Linux, for example; see http://www.filewatcher.com/m/TakaoPGothic.ttf.6234746-0.html
[2] http://www.microsoft.com/typography/otspec/vmtx.htm
(Assignee)

Comment 1

3 years ago
Created attachment 8547070 [details] [diff] [review]
Calculate vertical glyph origin based on 'vmtx' table in TrueType fonts
Attachment #8547070 - Flags: review?(jdaggett)
(Assignee)

Updated

3 years ago
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
(Assignee)

Comment 2

3 years ago
Created attachment 8547083 [details]
screenshot showing result of current trunk code (left) and patched (right)

This shows the incorrect result we get due to this bug, and the correct result when we return a proper vertical origin for the glyphs.

Comment 3

3 years ago
Comment on attachment 8547070 [details] [diff] [review]
Calculate vertical glyph origin based on 'vmtx' table in TrueType fonts

Review of attachment 8547070 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with one minor nit fixed

mLocaFormatLong would probably be more aptly named 'mLocaLongOffsets'.
Attachment #8547070 - Flags: review?(jdaggett) → review+
(Assignee)

Comment 4

3 years ago
Pushed, with name change as requested:
https://hg.mozilla.org/integration/mozilla-inbound/rev/60b2a0b2430c
Target Milestone: --- → mozilla38
https://hg.mozilla.org/mozilla-central/rev/60b2a0b2430c
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.