Closed Bug 438702 Opened 16 years ago Closed 13 years ago

Canvas text baselines not fully implemented

Categories

(Core :: Graphics: Canvas2D, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: ebutler, Assigned: jag+mozilla)

References

(Blocks 1 open bug)

Details

(Keywords: html5)

Attachments

(2 files)

The textBaseline attribute of Canvas is not fully implemented. The "ideographic" and "hanging" baselines are currently silently treated as the "alphabetic" baseline due to lack of font metric support.
Not sure Sanskrit and Chinese are the right glyphs to trigger hanging and ideographic, but replacing the text is easy enough.

Webkit doesn't seem to properly handle hanging and ideographic either, though they've picked "top" as the fallback for "hanging", and "bottom" as the fallback for "ideographic".

What is "hanging" supposed to do for non-hanging glyphs? Depending on the answer to that we might also want to make "top" the fallback for "hanging".
this is how it's /supposed/ to work

http://www.whatwg.org/specs/web-apps/current-work/images/baselines.png 


isn't that just height - x-height + top ?
and ideographic is the (bottom - (heightofasiancharacter-bottom))?
Jamie Pate: I interpret the colored lines matching the colored glyphs to mean that certain concepts only apply to certain groups of glyphs. Is that what you mean?
In SVG we apparently do let "hanging" fall through to "top" (called text_before_edge there), so for consistency with SVG and with Webkit I think we should too.
Attachment #502346 - Flags: review? → review?(roc)
Comment on attachment 502346 [details] [diff] [review]
Make "hanging" like "top" for parity with SVG and webkit.

Just noticed I left an extra |break;| in. That should be removed before check-in.
As an heuristic for "hanging" the point halfway between xHeight and emAscent seems to work reasonably well.
Attachment #502346 - Flags: approval2.0?
Comment on attachment 502346 [details] [diff] [review]
Make "hanging" like "top" for parity with SVG and webkit.

Sorry, it's just too late for this bug to land (especially with no tests). Let's get it in post-2.0.0.
Attachment #502346 - Flags: approval2.0? → approval2.0-
http://hg.mozilla.org/projects/cedar/rev/ba272ca52713
Assignee: nobody → jag-mozilla
Whiteboard: fixed-in-cedar
http://hg.mozilla.org/mozilla-central/rev/ba272ca52713
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: fixed-in-cedar
Target Milestone: --- → mozilla2.2
Blocks: 1325836
You need to log in before you can comment on or make changes to this bug.