mozDrawText: text dimensions, bounding rectangles

UNCONFIRMED
Unassigned

Status

()

Core
Canvas: 2D
P4
enhancement
UNCONFIRMED
10 years ago
10 years ago

People

(Reporter: Ilmari Heikkinen, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
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
You need to log in before you can comment on or make changes to this bug.