Open Bug 406117 Opened 17 years ago Updated 2 years ago

mozDrawText: text dimensions, bounding rectangles

Categories

(Core :: Graphics: Canvas2D, enhancement, P4)

enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: ilmari.heikkinen, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9b1) Gecko/2007113004 Minefield/3.0b1
Build Identifier: 

mozMeasureText only returning the width of the string makes writing text layout a bit hard. I could really use height and baseline. Especially since the text draw origin is the font baseline. It's very difficult to e.g. write text inside a box (don't know height, and even if did, don't know baseline.)

For checking if the mouse cursor is above the text, creating a path that consists of rectangles (of glyph-width * font-height -size) would be useful.

I'd propose: 
1) making mozMeasureText return an object with all the text dimensions
2) making it possible to set text origin (top-left, baseline)
3) adding mozTextRect and mozTextRectAlongPath to create the rectangle paths
[ 4) text alignment as part of text style might be nice ]

Reproducible: Always
Priority: -- → P4
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.