Skip to content

AI-native design editor. Open-source Figma alternative.

fix(fig): preserve explicit text alignment metadata

Danila Poyarkove971f735ef42
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9934f0e20..413ef0d34 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,8 @@
### Fixed
+- Preserve explicit text alignment metadata on imported Figma vectors across save and reload.
+
- Preserve explicit normal blend modes on imported Figma text and vector nodes across save and reload.
- Preserve implicit fixed-size text inside imported Figma auto-layout frames across save and reload.
@@ -98,7 +100,6 @@
- Index Figma clipboard children once during import instead of rescanning every pasted node, keeping large flat pastes linear. (#500)
- Reduce peak memory during `.fig` export by sharing immutable binary resources with the isolated export graph.
-
## 0.14.0 — 2026-08-10
### Breaking changes
@@ -540,7 +541,6 @@
- Fix component property override resolution through clone chains.
- Fix text/property overrides clobbered by second transitive sync.
-
- Fix text rendering with wrong fonts on file open — all font weights (including default family) are now loaded before the first render.
- Fix `weightToStyle` mapping: weight 400 now correctly maps to "Regular" instead of "Medium".
- Fix detached ArrayBuffer crash when switching pages after saving — export worker now copies image buffers before transferring.
@@ -664,7 +664,6 @@
- Add `geometry.ts` with shared rotation math (`degToRad`, `radToDeg`, `rotatePoint`, `rotatedCorners`, `rotatedBBox`).
- Extract `isArrayMixed()` helper for multi-selection property panels.
-
- Add `motion-v` for declarative animations — used in mobile drawer (spring-animated height with pan gestures) and toolbar (layout-animated category switching with directional slide transitions).
- Mobile drawer: replace `useSwipe` + manual rAF animation with `motion.div` `:animate` + `@pan`/`@panEnd`; always-on tab state (no more null `activeRibbonTab`); content stays rendered when closed.
- Mobile toolbar: replace manual `scrollWidth` measuring + inline CSS transitions with `motion.div layout` + `AnimatePresence` directional slide variants.
@@ -815,18 +814,15 @@
- Fix font picker dropdown truncating long font names.
- Show explanation in font picker when Local Font Access API unavailable (Safari/Firefox).
-
- Auto-populate GitHub Release notes from CHANGELOG.md via `ffurrer2/extract-release-notes@v2`.
- Skip already-published npm versions on CI re-runs instead of failing.
- Exclude non-app directories from Vite file watcher.
-
- Extract shared color constants (`BLACK`, `TRANSPARENT`, `DEFAULT_SHADOW_COLOR`) — replaces 8 inline literals across core.
- Extract shared `NodeContextMenuContent` component to avoid menu duplication.
- Fix `@open-pencil/core` dep in MCP package: `workspace:*` for local dev (pnpm resolves at publish time).
- Replace store thunks with a late-binding proxy.
-
- Clipboard roundtrip tests: encode to Figma Kiwi binary → decode → verify.
- 9 visual regression snapshot tests for effects rendering.
- Zoom/pan E2E tests and pipeline benchmark.
@@ -858,7 +854,6 @@
- Import additional properties from Figma clipboard: `layoutAlignSelf`, `clipsContent`, `fontWeight`, `italic`, `letterSpacing`, `lineHeight`.
- Convert `letterSpacing` PERCENT units to pixels based on font size.
-
- 7 new clipboard import unit tests (14 total).
### Fixed
@@ -998,13 +993,11 @@ First public alpha. The editor is functional but not production-ready.
- ScrubInput drag-to-change number controls.
- Resizable side panels via reka-ui Splitter.
-
- .fig file import via Kiwi binary codec (194 definitions, ~390 fields).
- .fig file export with Kiwi encoding, Zstd compression, thumbnail generation.
- Figma clipboard: copy/paste between OpenPencil and Figma.
- Round-trip fidelity for supported node types.
-
- Built-in AI chat in properties panel (⌘J).
- Direct browser → OpenRouter communication, no backend.
- Model selector: Claude, Gemini, GPT, DeepSeek, Qwen, Kimi, Llama.
@@ -1012,12 +1005,10 @@ First public alpha. The editor is functional but not production-ready.
- Streaming markdown responses (vue-stream-markdown).
- Tool call timeline with collapsible details.
-
- JSX export of selected nodes with Tailwind-like shorthand props.
- Syntax highlighting via Prism.js.
- Copy to clipboard.
-
- `info` — document stats, node types, fonts.
- `tree` — visual node tree.
- `find` — search by name/type.
@@ -1032,25 +1023,21 @@ First public alpha. The editor is functional but not production-ready.
- `analyze clusters` — repeated patterns.
- All commands support `--json`.
-
- Scene graph with flat Map storage and parentIndex tree.
- FigmaAPI with ~65% Figma plugin API compatibility.
- JSX renderer (TreeNode builder functions with shorthand props).
- Kiwi binary codec (encode/decode).
- Vector network blob encoder/decoder.
-
- Tauri v2 (~5 MB).
- Native menu bar, save/open dialogs.
- System font enumeration via font-kit.
- Zstd compression in Rust.
- macOS and Windows builds via GitHub Actions.
-
- Runs at [app.openpencil.dev](https://app.openpencil.dev).
- No installation required.
- File System Access API for save/open (Chrome/Edge), download fallback elsewhere.
-
- [openpencil.dev](https://openpencil.dev) — VitePress site with user guide, reference, and development docs.
- Deployed via Cloudflare Pages.
diff --git a/packages/fig/src/node-change/convert.ts b/packages/fig/src/node-change/convert.ts
index de1ef7814..e7d1acf44 100644
--- a/packages/fig/src/node-change/convert.ts
+++ b/packages/fig/src/node-change/convert.ts
@@ -1072,6 +1072,8 @@ export const FIGMA_RAW_NODE_FIELD_KEYS = [
'gridChildVerticalAlign',
'gridChildHorizontalAlign',
'textAutoResize',
+ 'textAlignHorizontal',
+ 'textAlignVertical',
'textData',
'lineHeight',
'fontName',
diff --git a/packages/fig/src/source-metadata.ts b/packages/fig/src/source-metadata.ts
index d73b0d52d..1215047f2 100644
--- a/packages/fig/src/source-metadata.ts
+++ b/packages/fig/src/source-metadata.ts
@@ -25,6 +25,7 @@ const EDITED_RAW_FIELDS: Partial<Record<string, readonly string[]>> = {
fills: ['fillPaints', 'backgroundPaints', 'backgroundColor'],
strokes: ['strokePaints'],
effects: ['effects'],
+ blendMode: ['blendMode'],
layoutGrids: ['layoutGrids'],
guides: ['guides'],
exportSettings: ['exportSettings'],
@@ -58,6 +59,8 @@ const EDITED_RAW_FIELDS: Partial<Record<string, readonly string[]>> = {
fontFamily: ['fontName', 'fontVersion', ...TEXT_DERIVED_RAW_FIELDS],
fontWeight: ['semanticWeight', ...TEXT_DERIVED_RAW_FIELDS],
italic: ['semanticItalic', ...TEXT_DERIVED_RAW_FIELDS],
+ textAlignHorizontal: ['textAlignHorizontal', ...TEXT_DERIVED_RAW_FIELDS],
+ textAlignVertical: ['textAlignVertical', ...TEXT_DERIVED_RAW_FIELDS],
lineHeight: ['lineHeight', ...TEXT_DERIVED_RAW_FIELDS],
letterSpacing: ['letterSpacing', 'textTracking', ...TEXT_DERIVED_RAW_FIELDS],
textAutoResize: ['textAutoResize', ...TEXT_DERIVED_RAW_FIELDS],
diff --git a/packages/fig/tests/source-metadata.test.ts b/packages/fig/tests/source-metadata.test.ts
index 4f71cc62f..1ab91bf96 100644
--- a/packages/fig/tests/source-metadata.test.ts
+++ b/packages/fig/tests/source-metadata.test.ts
@@ -23,6 +23,25 @@ describe('@open-pencil/fig source metadata policy', () => {
expect(node.source.fig.rawNodeFields.fillPaints).toBeDefined()
})
+ test('invalidates explicit blend and text alignment metadata after edits', () => {
+ const graph = new SceneGraph()
+ const node = graph.createNode('VECTOR', graph.getPages()[0].id)
+ node.source.fig.rawNodeFields = {
+ blendMode: 'NORMAL',
+ textAlignHorizontal: 'CENTER',
+ textAlignVertical: 'CENTER',
+ derivedTextData: { layoutSize: { x: 24, y: 24 } }
+ }
+
+ graph.updateNode(node.id, {
+ blendMode: 'MULTIPLY',
+ textAlignHorizontal: 'LEFT',
+ textAlignVertical: 'TOP'
+ })
+
+ expect(effectiveFigmaRawNodeFields(node)).toEqual({})
+ })
+
test('invalidates effective raw geometry without deleting provenance', () => {
const graph = new SceneGraph()
const node = graph.createNode('RECTANGLE', graph.getPages()[0].id)
diff --git a/tests/engine/io/fig/import/raw-field-coverage.test.ts b/tests/engine/io/fig/import/raw-field-coverage.test.ts
index a22cc1a3d..0a108f13e 100644
--- a/tests/engine/io/fig/import/raw-field-coverage.test.ts
+++ b/tests/engine/io/fig/import/raw-field-coverage.test.ts
@@ -37,6 +37,8 @@ const RAW_FIELD_COVERAGE = {
'strokeJoin',
'strokePaints',
'strokeWeight',
+ 'textAlignHorizontal',
+ 'textAlignVertical',
'textAutoResize',
'textData',
'textDecorationStyle',
diff --git a/tests/engine/io/fig/roundtrip/basic.test.ts b/tests/engine/io/fig/roundtrip/basic.test.ts
index 2780057b7..fe58518e6 100644
--- a/tests/engine/io/fig/roundtrip/basic.test.ts
+++ b/tests/engine/io/fig/roundtrip/basic.test.ts
@@ -150,6 +150,35 @@ describe('roundtrip: export → re-import', () => {
reImportedNodes = collectAllNodes(reImported)
})
+ test('preserves explicit text alignment on imported vector nodes', async () => {
+ await initCodec()
+ const graph = new SceneGraph()
+ const page = graph.getPages()[0]
+ const vector = graph.createNode('VECTOR', page.id, {
+ name: 'Text-origin vector',
+ textAlignHorizontal: 'CENTER',
+ textAlignVertical: 'CENTER',
+ source: {
+ ...page.source,
+ format: 'fig',
+ id: '1:3',
+ fig: {
+ ...page.source.fig,
+ rawNodeFields: {
+ textAlignHorizontal: 'CENTER',
+ textAlignVertical: 'CENTER'
+ }
+ }
+ }
+ })
+
+ const restored = await parseFigFile((await exportFigFile(graph)).buffer as ArrayBuffer)
+ const roundTripped = restored.getAllNodes().find((node) => node.name === vector.name)
+
+ expect(roundTripped?.textAlignHorizontal).toBe('CENTER')
+ expect(roundTripped?.textAlignVertical).toBe('CENTER')
+ })
+
test('preserves explicit NORMAL on imported nodes', async () => {
await initCodec()
const graph = new SceneGraph()