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:
parent
680350cdcb
commit
7cfa08aec5
|
|
@ -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
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue