Skip to content

Text/BitmapText bounding box incorrect when scaled or using different textBaseline #1345

@obiot

Description

@obiot

Description

Two related bounding box issues:

  1. BitmapText scaled: When a BitmapText is scaled, the debug bounding box doesn't match the rendered text size — it uses unscaled dimensions.
Image
  1. Text textBaseline: The debug bounding box doesn't correctly align with rendered text when using different textBaseline values ("bottom", "ideographic", "alphabetic", "middle", "hanging", "top").
Image

Steps to reproduce

  1. Create scaled BitmapText or Text with different textBaseline settings
  2. Enable the debug plugin (shows green bounding boxes)
  3. Observe misaligned bounding boxes

Expected behavior

Bounding boxes should tightly wrap the rendered text regardless of scale or baseline setting.

Technical details

  • BitmapText: scale factor not applied to measured text dimensions
  • Text: y-position calculation in TextMetrics.measureText() (textmetrics.js lines 116-122) uses simplified baseline-to-offset mapping that doesn't match actual canvas rendering

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions