Skip to content

fix: normalize Lynx text metrics - #2114

Merged
xuefei1313 merged 1 commit into
developfrom
agent/fix-lynx-text-metrics
Aug 7, 2026
Merged

fix: normalize Lynx text metrics#2114
xuefei1313 merged 1 commit into
developfrom
agent/fix-lynx-text-metrics

Conversation

@xuefei1313

Copy link
Copy Markdown
Contributor

What changed

  • preserve native Lynx measureText() ascent/descent metrics instead of discarding them
  • normalize device-scaled font bounding metrics by the canvas DPR
  • add a focused regression test
  • add Lynx Tooltip and baseline-matrix smoke scenes for visual verification

Root cause

The Lynx context previously returned only text width and forced VRender to estimate ascent/descent with fixed font-size ratios. That made text layout diverge from browser Canvas while symbols retained the expected coordinates.

Impact

Lynx text layout can use native font metrics, keeping Tooltip text aligned without VChart- or Tooltip-specific offsets. Unsupported metrics still fall through to VRender's existing fallback behavior.

Validation

  • Lynx demo visually verified on device
  • rushx test --runInBand __tests__/unit/lynx-context.test.ts
  • rushx compile in packages/vrender-kits
  • Lynx demo lint and typecheck
  • repository pre-push package test suite

@github-actions github-actions Bot added the kits label Aug 7, 2026
@xuefei1313
xuefei1313 merged commit cdb265b into develop Aug 7, 2026
5 of 7 checks passed
@xuefei1313
xuefei1313 deleted the agent/fix-lynx-text-metrics branch August 7, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant