Skip to content

Canvas textBaseline needs better tests #6731

Open
@AshleyScirra

Description

@AshleyScirra

Chrome and Safari draw text with the "top" baseline at different positions in canvas2d. See the following issues:

https://bugs.webkit.org/show_bug.cgi?id=226334
https://bugs.chromium.org/p/chromium/issues/detail?id=1213949

Image demonstrating comparison: https://downloads.scirra.com/labs/bugs/text-top-baseline/comparison.png

This causes web compat issues. For example our web game engine cannot display text consistently across platforms because each browser positions text slightly differently. This makes it difficult to do things like perfectly align text relative to other canvas drawings, such as in a border or button graphic.

Apparently this was previously discussed to some extent in #2470 but is not adequately resolved as it is still actively causing web compat issues and the spec does not appear to cover a definition of "the em square".

The spec should clearly define this so browser makers can identify if their browser complies with the spec in this regard, and if necessary make changes to their implementation to ensure compatibility. As it is I don't think it's clear which browser is doing it right (if any).

Metadata

Metadata

Assignees

No one assigned

    Labels

    interopImplementations are not interoperable with each otherneeds testsMoving the issue forward requires someone to write teststopic: canvas

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions