Closed
Bug 442133
Opened 16 years ago
Closed 16 years ago
Canvas text sizes depend on browser text zoom
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: philip, Assigned: ebutler)
References
()
Details
Attachments
(2 files, 1 obsolete file)
1.70 KB,
patch
|
vlad
:
review+
|
Details | Diff | Splinter Review |
565 bytes,
text/html
|
Details |
To reproduce: * Open http://philip.html5.org/tests/canvas/misc/changing-font-size.html * Zoom the page in/out Expected results: The text drawn into the canvas should be a consistent size in canvas coordinate space units - "16px" should always correspond to 16 canvas units. Actual results: The canvas text size is affected by the browser's zoom. This is a problem since it makes careful layouts much less reliable: people will assume a 16px font is about the same size as a rect(0, 0, w, 16), but if a user zooms in (or increases their text-only zoom) to 200% then that assumption will be very wrong.
Comment 1•16 years ago
|
||
use |AppUnitsPerCSSPixel()| instead of |AppUnitsPerDevPixel()| when creating |gfxFontStyle|.
Attachment #327323 -
Flags: review?(vladimir)
Comment on attachment 327323 [details] [diff] [review] Patch Looks right to me, Eric can you confirm?
Attachment #327323 -
Flags: superreview+
Attachment #327323 -
Flags: review?(vladimir)
Attachment #327323 -
Flags: review?(ebutler)
Assignee | ||
Comment 3•16 years ago
|
||
Comment on attachment 327323 [details] [diff] [review] Patch Worked when I tested it, and measureText and drawText seem to behave consistently under different zooms.
Attachment #327323 -
Flags: review?(ebutler) → review+
Updated•16 years ago
|
Assignee: nobody → taken.spc
Keywords: checkin-needed
Assignee | ||
Comment 4•16 years ago
|
||
Comment on attachment 327323 [details] [diff] [review] Patch I just noticed that while the text draws correctly, measureText returns erroneous results when text-only zoom is used. measureText should return the same value regardless of zoom. This is because dev pixels are used in the drawText and measureText instead of CSS pixels
Attachment #327323 -
Flags: review+ → review-
Assignee | ||
Updated•16 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 5•16 years ago
|
||
Includes the correction from the previous patch for full-page zoom, as well as a new correct for text-only zoom. Canvas text will now be completely unaffected by text zoom.
Attachment #327323 -
Attachment is obsolete: true
Attachment #327875 -
Flags: review?(vladimir)
Attachment #327875 -
Flags: review?(vladimir) → review+
Comment 6•16 years ago
|
||
Thanks ebutler for your patch! # I'm being busy temporary :-(.
Assignee: taken.spc → ebutler
Comment 7•16 years ago
|
||
Pushed changeset 94b3ceae4041 http://hg.mozilla.org/index.cgi/mozilla-central/rev/94b3ceae4041
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 8•16 years ago
|
||
Verified fix on Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b2pre) Gecko/20081023 Minefield/3.1b2pre.
Status: RESOLVED → VERIFIED
Comment 9•10 years ago
|
||
I was working on a hack to figure out whether a character were supported in a given font (by converting to canvas to see whether boxed hex code patterns were shown or not), and I ran across the fact that measureText returns a different value depending on zoom if the character is not supported in the font.
You need to log in
before you can comment on or make changes to this bug.
Description
•