fix(clipboard): normalize glyph advance by fontSize

Figma expects derivedTextData glyph advance values normalized to
font-size units (advance / fontSize), not absolute pixel values.
This caused pasted text to appear horizontally mirrored because
Figma multiplied the already-absolute advances by fontSize again.
This commit is contained in:
Danila Poyarkov 2026-05-16 18:02:10 +03:00
parent 680350cdcb
commit 7cfa08aec5
2 changed files with 1 additions and 2 deletions

View file

@ -72,7 +72,7 @@ export async function buildDerivedTextDataV4(
},
fontSize: node.fontSize,
firstCharacter: shapedGlyph?.firstCharacter ?? index,
advance: shapedGlyph?.advance ?? fallbackGlyphAdvance,
advance: (shapedGlyph?.advance ?? fallbackGlyphAdvance) / node.fontSize,
rotation: 0
}
})

View file

@ -1,6 +1,5 @@
import { expect, test, useEditorSetup } from '#tests/e2e/fixtures'
import { expectDefined } from '#tests/helpers/assert'
import { CanvasHelper } from '#tests/helpers/canvas'
const editor = useEditorSetup()