Skip to content

fix: support letter and word spacing in text - #252

Open
SulimanAbdulrazzaq wants to merge 4 commits into
antvis:mainfrom
SulimanAbdulrazzaq:agent/fix-text-spacing
Open

fix: support letter and word spacing in text#252
SulimanAbdulrazzaq wants to merge 4 commits into
antvis:mainfrom
SulimanAbdulrazzaq:agent/fix-text-spacing

Conversation

@SulimanAbdulrazzaq

Copy link
Copy Markdown

Summary

Fixes #184.

  • Include letterSpacing and wordSpacing in browser and SSR text measurements.
  • Preserve word-spacing through the text renderer and apply both spacing values as CSS lengths.
  • Add regression coverage for canvas/SSR measurement and rendered text styles.

This keeps the change focused on the core Text pipeline; business-component-specific style props and optional measurement caching are intentionally outside this PR.

Validation

  • prettier --check (passed)
  • git diff --check (passed)
  • Targeted Vitest and TypeScript checks were attempted, but the local dependency install is incomplete (missing ESM dependency files and malformed cached declaration files). GitHub CI should provide the clean dependency validation.

@Aarebecca

Copy link
Copy Markdown
Contributor

@SulimanAbdulrazzaq Thanks for working on this. The direction looks good, but the CI failure is a real type error. Also, measury@0.1.5 already applies numeric letterSpacing and wordSpacing, so passing them to measure() and then adding spacingWidth again would double-count spacing in SSR. The current mocked test hides this. Could you normalize the supported CSS lengths once, avoid the extra SSR addition, and add an unmocked regression test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

文本间距属性 (letter/wordSpacing) 在测量层缺失且在业务组件层未透传,导致排版功能不可用

2 participants