diff --git a/Cargo.lock b/Cargo.lock index 5fdb9e27b..4202fbee6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2084,6 +2084,7 @@ dependencies = [ "craft-font-catalog", "figcraft-doc", "figcraft-geom", + "flate2", "harfrust 0.13.3", "icu_segmenter", "log", diff --git a/ROADMAP.md b/ROADMAP.md index a574499c0..289d371e7 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents) -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); pasted layers whose image the clipboard lacks are named and show a placeholder that reads as missing (#1646); paint-style colours on layers pasted from another design app keep their style instead of turning black (#1638); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); every file a command reads whole by path is a regular file within a cap that fits it: documents 16 GiB, placed images 256 MiB, CLI scripts 1 GiB; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every + and − stays in view; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); files nested 256 levels deep import on the browser's 1 MB stack (#1101); SVG and PDF exports count pattern sources and the renders they embed from the layer's depth, so one cap bounds a whole export (#1082); an explicit variables file path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #1114); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); component properties keep the order they were made in when one is renamed, and Make slot asks for the slot's name first (#1536, #1537); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); a file's JPEG thumbnail can't crash the home screen (#1491's progressive JPEG check, now shared); `.fig` import: library text styles linked by asset key, and override rows restating a nested level (#1234); `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); Download a missing free font from the Missing fonts window (`font.download`, #754); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (web builds with craft-fonts embed Noto Sans Arabic by default so Persian and Arabic text draws without extra build flags (#1902); the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whether it was dropped or is still running and will take effect, and only screenshots and input blame the window (#1673); a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); pasted layers whose image the clipboard lacks are named and show a placeholder that reads as missing (#1646); paint-style colours on layers pasted from another design app keep their style instead of turning black (#1638); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); every file a command reads whole by path is a regular file within a cap that fits it: documents 16 GiB, placed images 256 MiB, CLI scripts 1 GiB; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every + and − stays in view; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); files nested 256 levels deep import on the browser's 1 MB stack (#1101); SVG and PDF exports count pattern sources and the renders they embed from the layer's depth, so one cap bounds a whole export (#1082); an explicit variables file path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #1114); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opening a `.figcraft` file unpacks at most 6 GiB in all (2 GiB in the browser), every area together (#1079); hovering the canvas hit-tests once per pointer move, not on every frame, and moving an auto layout frame no longer lays out its contents again on every move (#1571); `.fig` instance expansion no longer walks variable nodes for every instance or copies every outer override row into each nested instance (#1077); `comment.people` lists names that were only @mentioned, and `comment.next` and `comment.prompt` carry the mentions too (#1415); grid auto-placement looks for free cells a 64-bit word at a time and skips what blocks it, with the same placements (#1083); with the pen out, Enter or a double-click ends the path and edits the vector with the Move tool instead of drawing on (#1430); a recovery copy made while a version is previewed holds the file, not the version shown; a FigJam `.jam` file opens as a board (#1342); the Actions palette offers only commands that run from it, and no second row reading like a menu item: Place image opens the file dialog (#1574); share links can comment: a third access level beside edit and view, whose holder sees the file live and adds, replies to, reacts to and resolves comments but can't change the design; Preferences ▸ Scroll wheel zoom: a mouse wheel zooms the canvas about the pointer and Cmd/Ctrl+wheel scrolls (#1390); `comment.list {mentions}` lists only the threads that @mention a name (#1415); in the browser an internal error that stops the page keeps its unsaved files, which open again on reload (#1123); boolean operations refuse input past their caps, and a boolean group past them draws without its result (#1104); figcraft-cli parses its arguments with clap, following RFC-0012 (#1396); the selection and hover outlines of rounded rectangles and frames follow their corners (#1506); component properties keep the order they were made in when one is renamed, and Make slot asks for the slot's name first (#1536, #1537); the browser build publishes files to a server, so Share ▸ Online and Publish to server work there (#917); the browser build uses the fonts installed on the computer once asked, each read when text uses it (#1051); SVG import reads `color()` and `color-mix()` colours, with a note and a grey for those it can't (#1550); the portable Windows zip keeps its settings, recovery copies and plugins in `config\` beside the executable, starting with an installed copy's preferences; the window starts on other graphics when its first ones fail before the first frame: Direct3D 12 compiles with FXC and no device compiles wgpu's indirect-validation shaders, then Vulkan, OpenGL and lower requirements on the power-saving GPU (#965, #1438); Thai, Lao, Khmer and Burmese lines break between words (#1219); an AI agent attached over MCP shows where it works (#1416); a manual overlay's position can be dragged on the canvas (#405); one name for live sessions and comments: Preferences ▸ Your name, in the Join dialog too, kept in the browser, and a rename shows at once in the sessions you are in (#1380); requests that change a server's files have a budget per address, the server key's too, and join codes are found by their hash (#1075); the Join dialog shows a join from the click until its file is ready, with Cancel, and a failed join with Try again (#1381); SVG import draws each pattern tile once per scale, within the layer budget (#1080); Vietnamese letters typed with combining marks (decomposed) take one font that has every mark, instead of missing-glyph boxes beside the letter (#1478); comment.list reports each message's @mentions (#1415); mask groups draw only over the area they can paint, and nested isolated layers share one memory budget (#1061); components can't contain their own instances, directly or through other components; `edit.duplicate` returns an id map with `map: true` (#995); the batches kept for reconnecting apps are bounded in bytes by default, and `figcraft-server` takes `max_log_mb` (#1069); MCP and control calls name their document (#998); sibling placement in live sessions searches instead of counting (#1065); an AI agent attached over MCP comments under its own name, with an Agent label (#1414); the instance-swap menus have a search field (#1338); a refused batch's fixes take time linear in the batch (#1063); the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); large images on the canvas draw from a smaller copy, so two 16k images no longer lag (#1483); a file's JPEG thumbnail can't crash the home screen (#1491's progressive JPEG check, now shared); `.fig` import: library text styles linked by asset key, and override rows restating a nested level (#1234); `.fig` import keeps the file's saved line breaks while the text and its box are unedited (#1236); Download a missing free font from the Missing fonts window (`font.download`, #754); the web build's wasm back under its 24 MiB gate (#1472); shadows of images with transparent pixels follow their alpha (#1289); Crop image: Object ▸ Crop image, the right-click menu and the image fill row enter crop mode (`image.crop`, #1464); offline Penpot 2.x import/export (#1143); optional batch continue-on-error with per-step outcomes (#1386); the Design panel's sections on one grid (#858); FigJam outer shape outlines and sticky body fallback beside author text (#1341, #1397); images placed at their own size, 2x screenshots in points (#1360); the toolbar on one 32 pt grid, without its Resources button (#1210); M4: zero-length round-capped dashes draw dots; dash expansion uses the existing safety budget; extracted from #1143; Arabic draft catalog; scaled instances keep their scale when their main is rebuilt (#922); .fig embedded images are copied once per blob, not once per hash (#1059); page ruler guides survive save and reopen (#1476); colour picker LCH and OKLCH models; non-ASCII layer names transliterate in code export (#1235); branches in live sessions and branch history entries, gap 17; plugin widgets take text input and a property menu (plugin API 4); boards: templates and tables; boards: a shared timer and voting sessions; boards: the dot grid, connector ends dragged to re-attach, curved connectors; Installed weights of an embedded font family (#1246); `.sketch` import, best effort (Sketch 48 and newer); CJK line breaking: JIS X 4051's line-start and line-end sets completed with the halfwidth small kana, the halfwidth and spacing (semi-)voiced sound marks, the iteration marks 〱–〵 and the halfwidth parentheses, with behaviour cases for each; Adobe Fonts found on macOS (#298); egui 0.37 hidden-capture deadline contract; Dev Mode measurements kept on the canvas and a read-only layers panel; boards: a board area row and progress entry; community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7) FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow, native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through @@ -104,7 +104,7 @@ native speakers' reviews of the nine language drafts need people. | Traditional Chinese (Taiwan) | zh-Hant | 2,647 / 2,647 entries (100%, counted 2026-11-03) | draft (needs native review) | | Spanish | es, es-419 | 100% (es-419: an overlay of 101 entries) | draft (needs native review) | | Hindi | hi | 0% | none | -| Arabic | ar | 2,508 / 2,508 entries (100%, counted 2026-10-28) | draft; the window mirrors (panels swap sides); native review and mirrored panel rows pending | +| Arabic | ar | 2,508 / 2,508 entries (100%, counted 2026-10-28) | draft; web builds with craft-fonts offer Arabic by default; the window mirrors (panels swap sides); native review and mirrored panel rows pending | | French | fr | 95% | draft (needs native review) | | Portuguese (Brazil) | pt-BR | 95% | draft (needs native review) | | Indonesian | id | 99% | draft (needs native review) | @@ -133,6 +133,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). ## Progress log +- **2026-11-07** · M10, #1902: web builds with craft-fonts embed Noto Sans Arabic Regular by default, so Persian and Arabic text has a fallback without `FIGCRAFT_EMBED_SCRIPTS=Arab`; required web builds reject catalogs without that face. Web faces are compressed losslessly at build time and restored once at runtime to keep the default catalog within the WASM size budget. Additional scripts remain opt-in. Exact Iran Sans appearance still needs the installed font through supported browsers' local font access. Numbers unchanged. - **2026-11-05** · M2, #1823: Suggest auto layout is its own command. `layout.suggest` used to run `layout.add` and made one row of everything. It now splits a frame's layers into rows or columns by the gaps between them, wraps each band of several layers in a hugging frame without fill and repeats inside it, so the design gets as many auto layout frames as it needs and keeps its placement where the gaps are even (the frame keeps its size). Uneven gaps, bands that start at different offsets across the flow (lined up at the smallest) and layers that overlap along both axes are reported as `warnings`, and instances and layers inside them are refused. `layout.add` is unchanged. Tests in `layout_suggest_tests.rs`. Numbers unchanged. - **2026-11-05** · M3, #2002: the Local variables window selects several variables with a click, Shift+click (range) and Cmd/Ctrl+click (toggle), cleared by Escape or a click on the empty space; delete, move to a group and scope act on the selected local variables as one undo step (`command.batch`); inherited variables can be selected but are left out, since they change in their own collection, and the bulk menu needs two or more local variables selected (otherwise the row shows its own menu). Rename and value edits stay single-row. - **2026-11-05** · M10, #2014: the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic (`bidi::script_fallbacks`: one sample letter per script, the system's families for each; Bengali and Thai keep `crate::cjk`'s choice), so a layer name or a String variable's Amharic value draws in the panels instead of boxes. Test: `bidi::tests::other_scripts_take_an_installed_system_face`. @@ -364,6 +365,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md). | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | M10, #1902: web builds with craft-fonts embed Noto Sans Arabic Regular by default, so Persian and Arabic text has a fallback without `FIGCRAFT_EMBED_SCRIPTS=Arab`; required web builds reject catalogs without that face. Web faces are compressed losslessly at build time and restored once at runtime to keep the default catalog within the WASM size budget. Additional scripts remain opt-in. Exact Iran Sans appearance still needs the installed font through supported browsers' local font access. Numbers unchanged. | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`, 繁體中文(台灣)) draft catalog: every UI string (1,975), command label (641) and menu wording (31), translated clean-room from the English source; `zh-TW`, `zh-HK`, `zh-MO` and `zh-Hant` read it while an explicit Hans stays Simplified; the desktop UI prefers an installed Noto Sans CJK TC, then Microsoft JhengHei, PingFang TC and Heiti TC; no font is bundled; native review pending. Numbers unchanged | | 2026-11-06 | patch | M1, #2028: Edit ▸ Set default properties gives new rectangles, ellipses, polygons and stars drawn with the tools (and, set from a text layer, new text) the selected layer's properties; it only copied them for Paste properties. Tests: `default_props_tests` (3). Numbers unchanged | | 2026-11-06 | patch | M5, #2027: `proto.settings` refuses an unknown device name with the list of devices (it saved any string, and the presenter showed no device), takes known names in any case, and answers the page's prototype settings, so `proto.settings {}` reads them back over MCP. Test: `proto_present_tests::unknown_devices_are_refused_and_settings_read_back`. Numbers unchanged | diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index aea3d3be5..23b658e9d 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -8,6 +8,12 @@ description = "FigCraft text: font database (embedded craft-fonts + system fonts [lints] workspace = true +[build-dependencies] +flate2 = { workspace = true } + +[dev-dependencies] +flate2 = { workspace = true } + [dependencies] figcraft-geom = { workspace = true } figcraft-doc = { workspace = true } @@ -34,6 +40,7 @@ craft-font-catalog = { workspace = true } # wasm) instead of its dictionaries (~1.8 MB, which would take the .wasm past the 24 MiB gate in # packaging/web/package.sh). [target.'cfg(target_arch = "wasm32")'.dependencies] +flate2 = { workspace = true } icu_segmenter = { workspace = true, features = ["lstm"] } [target.'cfg(target_os = "macos")'.dependencies] diff --git a/crates/text/build.rs b/crates/text/build.rs index 796079968..38851f316 100644 --- a/crates/text/build.rs +++ b/crates/text/build.rs @@ -1,11 +1,13 @@ //! Embeds the optional craft-fonts build input (`CRAFT_FONTS_DIR`): both `fonts/manifest.txt` and the //! opt-in Latin presentation fonts in `fonts/latin-manifest.txt` (Inter, Roboto, …). Unset or missing, //! `CRAFT_FONTS` is empty and native apps use system fonts. Required web releases enforce Inter -//! Regular/SemiBold and Noto Sans Georgian Regular after filtering. Recipe: craft-fonts `docs/integration.md`. +//! Regular/SemiBold, Noto Sans Georgian Regular and Noto Sans Arabic Regular after filtering. +//! Recipe: craft-fonts `docs/integration.md`. //! Noto Sans CJK only with `FIGCRAFT_EMBED_CJK` set (the web build's only way to show CJK UI text). -//! The other scripts' faces (Noto Sans Arabic, Hebrew, Thai, Devanagari…) stay out of web builds unless -//! `FIGCRAFT_EMBED_SCRIPTS` names their script tags (`Arab,Hebr,Thai,Deva`: one tag per script wanted, -//! as the manifest's scripts column lists them; #1902). +//! Noto Sans Arabic is included by default so Persian and Arabic remain readable without local fonts +//! (#1902). Other scripts' faces (Hebrew, Thai, Devanagari…) stay out of web builds unless +//! `FIGCRAFT_EMBED_SCRIPTS` names their script tags (`Hebr,Thai,Deva`: one tag per script wanted, +//! as the manifest's scripts column lists them). //! `FIGCRAFT_WEB_FONTS` (comma-separated families) adds manifest families to the web build. use std::fmt::Write as _; use std::path::PathBuf; @@ -20,19 +22,31 @@ fn main() { println!("cargo::rerun-if-env-changed=FIGCRAFT_EMBED_CJK"); println!("cargo::rerun-if-env-changed=FIGCRAFT_EMBED_SCRIPTS"); println!("cargo::rerun-if-env-changed=FIGCRAFT_WEB_FONTS"); - let mut src = String::from("pub static CRAFT_FONTS: &[CraftFont] = &[\n"); let dir = std::env::var_os("CRAFT_FONTS_DIR").map(PathBuf::from); let required = std::env::var_os("CRAFT_FONTS_REQUIRED").is_some(); let wasm = std::env::var("CARGO_CFG_TARGET_ARCH").is_ok_and(|a| a == "wasm32"); let embed_cjk = std::env::var_os("FIGCRAFT_EMBED_CJK").is_some(); let embed_scripts = scripts_from(std::env::var("FIGCRAFT_EMBED_SCRIPTS").ok().as_deref()); let web_fonts = web_fonts(&std::env::var("FIGCRAFT_WEB_FONTS").unwrap_or_default()); - match input_fonts(dir.as_deref(), wasm, required, embed_cjk, &embed_scripts, &web_fonts) { + let out_dir = PathBuf::from(std::env::var_os("OUT_DIR").unwrap_or_default()); + // Compress the complete web catalog so adding the Arabic fallback stays within the WASM + // size budget. Each face is restored once, byte-for-byte, before the existing font consumers. + let mut src = if wasm { + String::from( + "pub static CRAFT_FONTS: std::sync::LazyLock> = std::sync::LazyLock::new(|| {\n static PACKED: &[(&str, &str, &crate::embedded::PackedFont)] = &[\n", + ) + } else { + String::from("pub static CRAFT_FONTS: &[CraftFont] = &[\n") + }; + match input_fonts(dir.as_deref(), wasm, required, embed_cjk, &embed_scripts, &web_fonts, wasm.then_some(out_dir.as_path())) { Ok(entries) => src.push_str(&entries), Err(e) => println!("cargo::error={e}"), } src.push_str("];\n"); - let out = PathBuf::from(std::env::var_os("OUT_DIR").unwrap_or_default()).join("craft_fonts.rs"); + if wasm { + src.push_str(" PACKED.iter().filter_map(|(family, style, font)| Some(CraftFont { family, style, bytes: font.data()? })).collect()\n});\n"); + } + let out = out_dir.join("craft_fonts.rs"); if let Err(e) = std::fs::write(&out, src) { println!("cargo::error=writing {}: {e}", out.display()); } @@ -64,6 +78,7 @@ fn input_fonts( embed_cjk: bool, embed_scripts: &[String], web_fonts: &[String], + packed_dir: Option<&std::path::Path>, ) -> Result { let Some(dir) = dir else { for family in web_fonts { @@ -80,7 +95,7 @@ fn input_fonts( watch(&path); continue; } - match craft_fonts(dir, manifest, wasm, embed_cjk, embed_scripts, web_fonts) { + match craft_fonts(dir, manifest, wasm, embed_cjk, embed_scripts, web_fonts, packed_dir) { Ok(catalog) => { loaded = true; out.push_str(&catalog.entries); @@ -96,7 +111,7 @@ fn input_fonts( println!("cargo::warning=FIGCRAFT_WEB_FONTS: {family:?} isn't embedded: {why}"); } if required && wasm { - for (family, style) in [("Inter", "Regular"), ("Inter", "SemiBold"), ("Noto Sans Georgian", "Regular")] { + for (family, style) in [("Inter", "Regular"), ("Inter", "SemiBold"), ("Noto Sans Georgian", "Regular"), ("Noto Sans Arabic", "Regular")] { if !faces.iter().any(|(f, s)| f == family && s == style) { return Err(format!("required web font missing: {family} {style}; CRAFT_FONTS_DIR must include both Latin and core release faces")); } @@ -135,6 +150,7 @@ fn craft_fonts( embed_cjk: bool, embed_scripts: &[String], web_fonts: &[String], + packed_dir: Option<&std::path::Path>, ) -> Result { let manifest = dir.join(manifest_rel); watch(&manifest); @@ -155,25 +171,67 @@ fn craft_fonts( if cjk && !embed_cjk { continue; } - // Web builds have a size budget: Inter, Noto Sans Georgian (small, for the Georgian UI), only the - // SemiBold wordmark, optionally Noto Sans CJK (every CJK script, for CJK UI text), the faces - // of the scripts `FIGCRAFT_EMBED_SCRIPTS` names (an Arabic or Persian document needs Noto Sans - // Arabic, +0.8 MB; the browser has no system fonts to fall back on, #1902), and the + // Web builds have a size budget: Inter, Noto Sans Georgian (small, for the Georgian UI), + // Noto Sans Arabic (Persian/Arabic would otherwise show boxes without local fonts, #1902), + // only the SemiBold wordmark, optionally Noto Sans CJK (every CJK script, for CJK + // UI text), the faces of the scripts `FIGCRAFT_EMBED_SCRIPTS` names, and the // families a distribution names in `FIGCRAFT_WEB_FONTS` (a Thai face for Thai text, say). let wordmark = *family == "Archivo" && *style == "SemiBold"; let asked = scripts.split(',').map(str::trim).any(|s| embed_scripts.iter().any(|e| e.eq_ignore_ascii_case(s))); let added = web_fonts.iter().any(|f| f == family); - if wasm && !matches!(*family, "Inter" | "Noto Sans Georgian") && !wordmark && !cjk && !asked && !added { + if wasm && !matches!(*family, "Inter" | "Noto Sans Georgian" | "Noto Sans Arabic") && !wordmark && !cjk && !asked && !added { continue; } let path = dir.join(file).canonicalize().map_err(|e| format!("{file}: {e}"))?; println!("cargo::rerun-if-changed={}", path.display()); faces.push(((*family).to_owned(), (*style).to_owned())); - let _ = writeln!(out, " CraftFont {{ family: {family:?}, style: {style:?}, bytes: include_bytes!({:?}) }},", path.display().to_string()); + if let Some(packed_dir) = packed_dir.filter(|_| wasm) { + let (packed, len) = pack_font(&path, packed_dir)?; + let _ = writeln!( + out, + " ({family:?}, {style:?}, {{ static FONT: crate::embedded::PackedFont = crate::embedded::PackedFont::new(include_bytes!({:?}), {len}); &FONT }}),", + packed.display().to_string() + ); + } else { + let _ = + writeln!(out, " CraftFont {{ family: {family:?}, style: {style:?}, bytes: include_bytes!({:?}) }},", path.display().to_string()); + } } Ok(Catalog { entries: out, faces }) } +/// Write a lossless zlib copy under OUT_DIR, never into the font checkout. A path hash avoids +/// collisions between manifest entries without using their relative paths as output paths. +fn pack_font(path: &std::path::Path, out_dir: &std::path::Path) -> Result<(PathBuf, usize), String> { + use std::hash::{Hash, Hasher}; + use std::io::{Read as _, Write as _}; + // Keep this in step with embedded::unpack: a required face must not build successfully + // only to be discarded by the runtime decoder. Limit reads too, if the input changes. + const MAX_FONT_BYTES: u64 = 256 * 1024 * 1024; + let file = std::fs::File::open(path).map_err(|e| format!("{}: {e}", path.display()))?; + let len = file.metadata().map_err(|e| format!("{}: {e}", path.display()))?.len(); + if len == 0 || len > MAX_FONT_BYTES { + return Err(format!("{}: embedded font size must be 1..={MAX_FONT_BYTES} bytes", path.display())); + } + let mut bytes = Vec::new(); + file.take(MAX_FONT_BYTES + 1).read_to_end(&mut bytes).map_err(|e| format!("{}: {e}", path.display()))?; + if bytes.is_empty() || bytes.len() as u64 > MAX_FONT_BYTES { + return Err(format!("{}: embedded font size changed outside the supported range", path.display())); + } + let mut encoder = flate2::write::ZlibEncoder::new(Vec::new(), flate2::Compression::best()); + encoder.write_all(&bytes).map_err(|e| format!("compressing {}: {e}", path.display()))?; + let packed = encoder.finish().map_err(|e| format!("compressing {}: {e}", path.display()))?; + let mut hash = std::collections::hash_map::DefaultHasher::new(); + path.hash(&mut hash); + let output = out_dir.join(format!("font-{:016x}.zlib", hash.finish())); + std::fs::write(&output, packed).map_err(|e| format!("{}: {e}", output.display()))?; + Ok((output, bytes.len())) +} + +#[cfg(test)] +#[path = "tests/support/web_fallback.rs"] +mod web_fallback; + #[cfg(test)] mod tests { use super::*; @@ -181,18 +239,18 @@ mod tests { static NEXT: AtomicU64 = AtomicU64::new(0); - struct Fixture(PathBuf); + pub(super) struct Fixture(pub(super) PathBuf); impl Fixture { /// Test fixture: create a unique temporary directory, write a synthetic face file and - /// install the default Georgian manifest. - fn new() -> Self { + /// install the default Georgian and Arabic manifest. + pub(super) fn new() -> Self { let dir = std::env::temp_dir().join(format!("fig-font-input-{}-{}", std::process::id(), NEXT.fetch_add(1, Ordering::Relaxed))); std::fs::create_dir_all(dir.join("fonts")).unwrap(); // The build script validates manifest/file presence; font bytes are checked centrally. std::fs::write(dir.join("fonts/face.ttf"), b"synthetic build-input fixture").unwrap(); let fixture = Self(dir); - fixture.manifest("manifest.txt", &[("Noto Sans Georgian", "Regular")]); + fixture.manifest("manifest.txt", &[("Noto Sans Georgian", "Regular"), ("Noto Sans Arabic", "Regular")]); fixture } @@ -210,6 +268,32 @@ mod tests { } } + /// Fail at build time for sizes the runtime decoder cannot accept. + #[test] + fn web_font_compression_rejects_empty_and_oversized_inputs() { + let f = Fixture::new(); + let path = f.0.join("invalid.ttf"); + let file = std::fs::File::create(&path).unwrap(); + assert!(pack_font(&path, &f.0).unwrap_err().contains("font size")); + file.set_len(256 * 1024 * 1024 + 1).unwrap(); + assert!(pack_font(&path, &f.0).unwrap_err().contains("font size")); + } + + /// Web catalog entries embed lossless packed files; native entries still reference raw fonts. + #[test] + fn web_catalog_packs_fonts_and_native_keeps_original_bytes() { + let f = Fixture::new(); + let web = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &[], &[], Some(&f.0)).unwrap(); + assert_eq!(web.entries.matches("PackedFont::new").count(), 2); + let path = f.0.join("fonts/face.ttf").canonicalize().unwrap(); + let (packed, len) = pack_font(&path, &f.0).unwrap(); + assert!(web.entries.contains(&packed.display().to_string())); + assert_eq!(len, std::fs::read(&path).unwrap().len()); + let native = craft_fonts(&f.0, "fonts/manifest.txt", false, false, &[], &[], Some(&f.0)).unwrap(); + assert!(native.entries.contains(&path.display().to_string())); + assert!(!native.entries.contains("PackedFont")); + } + /// Asserts the native Latin catalog keeps its 43 permitted presentation faces, the web /// catalog keeps only the four Inter faces, Adobe-authored families are absent, and /// permitted native faces remain. @@ -217,9 +301,9 @@ mod tests { fn restored_latin_catalog_preserves_permitted_native_faces_and_web_budget() { let f = Fixture::new(); std::fs::write(f.0.join("fonts/latin-manifest.txt"), include_str!("tests/fixtures/latin-families.txt")).unwrap(); - let native = craft_fonts(&f.0, "fonts/latin-manifest.txt", false, false, &[], &[]).unwrap(); + let native = craft_fonts(&f.0, "fonts/latin-manifest.txt", false, false, &[], &[], None).unwrap(); assert_eq!(native.faces.len(), 43, "all prior permitted presentation faces remain available"); - let web = craft_fonts(&f.0, "fonts/latin-manifest.txt", true, false, &[], &[]).unwrap(); + let web = craft_fonts(&f.0, "fonts/latin-manifest.txt", true, false, &[], &[], None).unwrap(); assert_eq!(web.faces.len(), 4, "the web catalog keeps only the four Inter faces"); for catalog in [&native, &web] { assert!(!catalog.entries.contains("Source Sans 3")); @@ -227,30 +311,31 @@ mod tests { } assert!(native.faces.iter().any(|(family, _)| family == "Carlito")); assert!(native.faces.iter().any(|(family, _)| family == "Liberation Serif")); - assert!(input_fonts(Some(&f.0), true, true, false, &[], &[]).is_ok()); + assert!(input_fonts(Some(&f.0), true, true, false, &[], &[], None).is_ok()); } /// Asserts required web input rejects a catalog missing Inter Regular or Inter SemiBold. #[test] fn required_web_rejects_core_only_and_partial_latin_catalogs() { let f = Fixture::new(); - assert!(input_fonts(Some(&f.0), true, true, false, &[], &[]).unwrap_err().contains("Inter Regular")); + assert!(input_fonts(Some(&f.0), true, true, false, &[], &[], None).unwrap_err().contains("Inter Regular")); f.manifest("latin-manifest.txt", &[("Inter", "Regular"), ("Unrelated", "SemiBold")]); - assert!(input_fonts(Some(&f.0), true, true, false, &[], &[]).unwrap_err().contains("Inter SemiBold")); + assert!(input_fonts(Some(&f.0), true, true, false, &[], &[], None).unwrap_err().contains("Inter SemiBold")); } - /// Asserts required web input embeds the Inter and Georgian catalogs (three entries) and + /// Asserts required web input embeds the Inter, Georgian and Arabic catalogs (four entries) and /// rejects a manifest without Noto Sans Georgian Regular. #[test] fn required_web_embeds_both_catalogs_and_requires_georgian() { let f = Fixture::new(); f.manifest("latin-manifest.txt", &[("Inter", "Regular"), ("Inter", "SemiBold")]); - let entries = input_fonts(Some(&f.0), true, true, false, &[], &[]).unwrap(); - assert_eq!(entries.matches("CraftFont {").count(), 3); + let entries = input_fonts(Some(&f.0), true, true, false, &[], &[], None).unwrap(); + assert_eq!(entries.matches("CraftFont {").count(), 4); assert!(entries.contains("family: \"Inter\"")); assert!(entries.contains("family: \"Noto Sans Georgian\"")); + assert!(entries.contains("family: \"Noto Sans Arabic\"")); f.manifest("manifest.txt", &[("Other", "Regular")]); - assert!(input_fonts(Some(&f.0), true, true, false, &[], &[]).unwrap_err().contains("Noto Sans Georgian Regular")); + assert!(input_fonts(Some(&f.0), true, true, false, &[], &[], None).unwrap_err().contains("Noto Sans Georgian Regular")); } /// Asserts absent font input is empty when optional and an error when required, while present @@ -258,10 +343,10 @@ mod tests { #[test] fn optional_and_native_inputs_keep_their_existing_policy() { let f = Fixture::new(); - assert!(input_fonts(None, true, false, false, &[], &[]).unwrap().is_empty()); - assert!(input_fonts(None, true, true, false, &[], &[]).unwrap_err().contains("CRAFT_FONTS_DIR is missing")); - assert!(input_fonts(Some(&f.0), true, false, false, &[], &[]).unwrap().contains("Noto Sans Georgian")); - assert!(input_fonts(Some(&f.0), false, true, false, &[], &[]).unwrap().contains("Noto Sans Georgian")); + assert!(input_fonts(None, true, false, false, &[], &[], None).unwrap().is_empty()); + assert!(input_fonts(None, true, true, false, &[], &[], None).unwrap_err().contains("CRAFT_FONTS_DIR is missing")); + assert!(input_fonts(Some(&f.0), true, false, false, &[], &[], None).unwrap().contains("Noto Sans Georgian")); + assert!(input_fonts(Some(&f.0), false, true, false, &[], &[], None).unwrap().contains("Noto Sans Georgian")); } /// Asserts required web input rejects a manifest whose face file is missing, even when every @@ -271,12 +356,38 @@ mod tests { let f = Fixture::new(); f.manifest("latin-manifest.txt", &[("Inter", "Regular"), ("Inter", "SemiBold")]); std::fs::remove_file(f.0.join("fonts/face.ttf")).unwrap(); - assert!(input_fonts(Some(&f.0), true, true, false, &[], &[]).unwrap_err().contains("fonts/face.ttf")); + assert!(input_fonts(Some(&f.0), true, true, false, &[], &[], None).unwrap_err().contains("fonts/face.ttf")); } - /// #1902: a web build leaves the other scripts' faces out (an Arabic or Persian document shows - /// missing-glyph boxes) unless `FIGCRAFT_EMBED_SCRIPTS` names their script tags; native builds - /// keep every face, as before. + /// #1902: the default web catalog needs an Arabic fallback without local-font permission + /// or an extra distribution setting; otherwise Persian and Arabic text becomes boxes. + #[test] + fn default_web_catalog_keeps_arabic_without_opt_in() { + let f = Fixture::new(); + f.manifest("manifest.txt", &[("Noto Sans Georgian", "Regular"), ("Noto Sans Arabic", "Regular"), ("Noto Sans Hebrew", "Regular")]); + let entries = input_fonts(Some(&f.0), true, false, false, &[], &[], None).unwrap(); + assert!(entries.contains("family: \"Noto Sans Arabic\""), "default web text must have an Arabic/Persian fallback"); + assert!(!entries.contains("Noto Sans Hebrew"), "other scripts remain opt-in"); + } + + /// A required web release must not silently publish without its Arabic fallback. + #[test] + fn required_web_rejects_missing_arabic_regular() { + let f = Fixture::new(); + f.manifest("latin-manifest.txt", &[("Inter", "Regular"), ("Inter", "SemiBold")]); + for arabic in [None, Some("Bold")] { + let mut faces = vec![("Noto Sans Georgian", "Regular")]; + if let Some(style) = arabic { + faces.push(("Noto Sans Arabic", style)); + } + f.manifest("manifest.txt", &faces); + let result = input_fonts(Some(&f.0), true, true, false, &[], &[], None); + assert!(result.is_err_and(|e| e.contains("Noto Sans Arabic Regular")), "missing Arabic Regular must fail the release build"); + } + } + + /// Arabic is a default fallback; other scripts stay opt-in through `FIGCRAFT_EMBED_SCRIPTS`. + /// Native builds keep every face, as before. #[test] fn web_embeds_other_scripts_faces_only_when_asked() { let f = Fixture::new(); @@ -286,18 +397,18 @@ mod tests { ) .unwrap(); let families = |c: &Catalog| c.faces.iter().map(|(f, _)| f.clone()).collect::>(); - let web = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &[], &[]).unwrap(); - assert_eq!(families(&web), ["Noto Sans Georgian"], "the web budget: Georgian only"); - let arabic = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &["Arab".to_string()], &[]).unwrap(); + let web = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &[], &[], None).unwrap(); + assert_eq!(families(&web), ["Noto Sans Georgian", "Noto Sans Arabic"], "the default web script fallbacks"); + let arabic = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &["Arab".to_string()], &[], None).unwrap(); assert_eq!(families(&arabic), ["Noto Sans Georgian", "Noto Sans Arabic"]); // Several tags, any case, spaces, and a tag among a face's several scripts. - let more = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &scripts_from(Some(" hebr, LATN ")), &[]).unwrap(); - assert_eq!(families(&more), ["Noto Sans Georgian", "Noto Sans Hebrew", "Noto Sans Symbols"]); + let more = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &scripts_from(Some(" hebr, LATN ")), &[], None).unwrap(); + assert_eq!(families(&more), ["Noto Sans Georgian", "Noto Sans Arabic", "Noto Sans Hebrew", "Noto Sans Symbols"]); // Native builds keep every face whatever the variable says. - assert_eq!(craft_fonts(&f.0, "fonts/manifest.txt", false, false, &[], &[]).unwrap().faces.len(), 4); + assert_eq!(craft_fonts(&f.0, "fonts/manifest.txt", false, false, &[], &[], None).unwrap().faces.len(), 4); // The variable reaches the catalog through `input_fonts`. - assert!(input_fonts(Some(&f.0), true, false, false, &["Arab".into()], &[]).unwrap().contains("Noto Sans Arabic")); - assert!(!input_fonts(Some(&f.0), true, false, false, &[], &[]).unwrap().contains("Noto Sans Arabic")); + assert!(input_fonts(Some(&f.0), true, false, false, &["Arab".into()], &[], None).unwrap().contains("Noto Sans Arabic")); + assert!(input_fonts(Some(&f.0), true, false, false, &[], &[], None).unwrap().contains("Noto Sans Arabic")); assert!(scripts_from(None).is_empty()); } @@ -311,11 +422,15 @@ mod tests { let named = web_fonts(" Noto Sans Thai, ,Noto Sans Thia "); assert_eq!(named, ["Noto Sans Thai", "Noto Sans Thia"]); let families = |c: &Catalog| c.faces.iter().map(|(family, _)| family.clone()).collect::>(); - let web = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &[], &named).unwrap(); + let web = craft_fonts(&f.0, "fonts/manifest.txt", true, false, &[], &named, None).unwrap(); assert_eq!(families(&web), ["Noto Sans Georgian", "Noto Sans Thai"], "the named family joins; the others stay out"); - assert_eq!(families(&craft_fonts(&f.0, "fonts/manifest.txt", true, false, &[], &[]).unwrap()), ["Noto Sans Georgian"], "unset: as before"); - assert_eq!(craft_fonts(&f.0, "fonts/manifest.txt", false, false, &[], &[]).unwrap().faces.len(), 3, "native builds embed every family"); + assert_eq!( + families(&craft_fonts(&f.0, "fonts/manifest.txt", true, false, &[], &[], None).unwrap()), + ["Noto Sans Georgian"], + "unset: as before" + ); + assert_eq!(craft_fonts(&f.0, "fonts/manifest.txt", false, false, &[], &[], None).unwrap().faces.len(), 3, "native builds embed every family"); assert_eq!(not_embedded(&named, &web.faces), ["Noto Sans Thia"], "a misspelt family is reported"); - assert!(input_fonts(Some(&f.0), true, false, false, &[], &named).unwrap().contains("family: \"Noto Sans Thai\"")); + assert!(input_fonts(Some(&f.0), true, false, false, &[], &named, None).unwrap().contains("family: \"Noto Sans Thai\"")); } } diff --git a/crates/text/src/embedded.rs b/crates/text/src/embedded.rs new file mode 100644 index 000000000..d9be4625f --- /dev/null +++ b/crates/text/src/embedded.rs @@ -0,0 +1,88 @@ +//! Lossless decoding of web fonts, shared by the document renderer and UI through static bytes. + +use std::sync::OnceLock; + +/// Matches the font-file limit: corrupted metadata must not request an unbounded allocation. +const MAX_UNPACKED_FONT_BYTES: usize = 256 * 1024 * 1024; + +/// One embedded zlib stream, decoded at most once; invalid streams stay unavailable. +pub(crate) struct PackedFont { + bytes: &'static [u8], + unpacked_len: usize, + decoded: OnceLock>>, +} + +impl PackedFont { + pub(crate) const fn new(bytes: &'static [u8], unpacked_len: usize) -> Self { + Self { bytes, unpacked_len, decoded: OnceLock::new() } + } + + pub(crate) fn data(&'static self) -> Option<&'static [u8]> { + self.decoded.get_or_init(|| unpack(self.bytes, self.unpacked_len)).as_deref() + } +} + +/// Decode exactly the declared size, refusing malformed, incomplete or trailing data. +pub(crate) fn unpack(bytes: &[u8], unpacked_len: usize) -> Option> { + if unpacked_len == 0 || unpacked_len > MAX_UNPACKED_FONT_BYTES { + return None; + } + // A fixed output buffer prevents even a valid compressed stream expanding past its budget. + let mut decoded = Vec::new(); + decoded.try_reserve_exact(unpacked_len).ok()?; + decoded.resize(unpacked_len, 0); + let mut decoder = flate2::Decompress::new(true); + let status = decoder.decompress(bytes, &mut decoded, flate2::FlushDecompress::Finish).ok()?; + (status == flate2::Status::StreamEnd && decoder.total_out() == unpacked_len as u64 && decoder.total_in() == bytes.len() as u64).then_some(decoded) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::io::Write as _; + + // A zlib stream of the synthetic bytes "font"; no font asset is needed by these tests. + const PACKED: &[u8] = &[120, 218, 75, 203, 207, 43, 1, 0, 4, 57, 1, 184]; + + #[test] + fn compressed_bytes_round_trip_exactly() { + let original = b"synthetic font bytes\0\xff\x80\0synthetic font bytes"; + let mut encoder = flate2::write::ZlibEncoder::new(Vec::new(), flate2::Compression::best()); + encoder.write_all(original).unwrap(); + let packed = encoder.finish().unwrap(); + assert_eq!(unpack(&packed, original.len()).unwrap(), original); + } + + #[test] + fn corrupt_truncated_and_trailing_streams_are_refused() { + assert!(unpack(b"not a zlib stream", 4).is_none()); + for end in 0..PACKED.len() { + assert!(unpack(&PACKED[..end], 4).is_none(), "truncated at byte {end}"); + } + let mut corrupt = PACKED.to_vec(); + corrupt[11] ^= 1; + assert!(unpack(&corrupt, 4).is_none(), "checksum mismatch"); + let mut trailing = PACKED.to_vec(); + trailing.push(0); + assert!(unpack(&trailing, 4).is_none(), "trailing bytes"); + } + + #[test] + fn declared_size_is_exact_and_bounded() { + for len in [0, 3, 5, MAX_UNPACKED_FONT_BYTES + 1, usize::MAX] { + assert!(unpack(PACKED, len).is_none(), "invalid unpacked size {len}"); + } + assert_eq!(unpack(PACKED, 4).unwrap(), b"font"); + } + + #[test] + fn decoded_bytes_and_failures_are_cached() { + static FONT: PackedFont = PackedFont::new(PACKED, 4); + static BAD: PackedFont = PackedFont::new(PACKED, 3); + let first = FONT.data().unwrap(); + assert_eq!(first, b"font"); + assert!(std::ptr::eq(first, FONT.data().unwrap())); + assert!(BAD.data().is_none()); + assert!(BAD.decoded.get().is_some_and(Option::is_none)); + } +} diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index 3c82cd261..b9bb70232 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -695,7 +695,7 @@ pub fn db() -> &'static RwLock { fn raw_db() -> &'static RwLock { DB.get_or_init(|| { let mut db = FontDb::default(); - for f in CRAFT_FONTS { + for f in CRAFT_FONTS.iter() { if let Some(face) = Face::from_bytes(FontBytes::Static(f.bytes), 0, Some(f.family), Some(f.style)) { db.add(face); } diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index b6d87d669..37f603464 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -9,6 +9,8 @@ mod breaks; pub mod color; pub mod display; +#[cfg(target_arch = "wasm32")] +mod embedded; pub mod fontdb; mod layout; mod onpath; diff --git a/crates/text/tests/support/web_fallback.rs b/crates/text/tests/support/web_fallback.rs new file mode 100644 index 000000000..16a930328 --- /dev/null +++ b/crates/text/tests/support/web_fallback.rs @@ -0,0 +1,82 @@ +//! Exercise shaping with the actual default web catalog, without desktop font fallbacks. + +use super::{craft_fonts, pack_font}; + +#[path = "../../src/embedded.rs"] +mod embedded; +use figcraft_text::fontdb::{Face, FontBytes}; + +#[test] +fn default_web_fonts_render_persian_and_arabic_without_system_fonts() { + let Some(dir) = std::env::var_os("CRAFT_FONTS_DIR").map(std::path::PathBuf::from).filter(|p| p.join("fonts/manifest.txt").is_file()) else { + eprintln!("craft-fonts is absent; build-policy fixtures still run, real-font shaping skipped"); + return; + }; + // Check source availability independently of the web filter under test. Otherwise removing + // Arabic from that filter would skip this regression instead of reproducing the boxes. + if [("Inter", "Regular"), ("Inter", "SemiBold"), ("Noto Sans Georgian", "Regular"), ("Noto Sans Arabic", "Regular")] + .iter() + .any(|(family, style)| !figcraft_text::CRAFT_FONTS.iter().any(|font| font.family == *family && font.style == *style)) + { + eprintln!("complete release font catalog is absent; build-policy fixtures still run, real-font shaping skipped"); + return; + } + let packed_dir = super::tests::Fixture::new(); + let mut faces = Vec::new(); + for manifest in ["fonts/latin-manifest.txt", "fonts/manifest.txt"] { + if dir.join(manifest).is_file() { + faces.extend(craft_fonts(&dir, manifest, true, false, &[], &[], None).unwrap().faces); + } + } + + // This integration-test process owns its font database. Native embedding includes more + // families than the web, so retain only the web build's faces and disable system discovery. + figcraft_text::opt_out_of_system_fonts(); + let has_all_inter_styles = ["Regular", "Italic", "SemiBold", "Bold"].iter().all(|style| faces.iter().any(|(f, s)| f == "Inter" && s == style)); + let mut prior_raw_bytes = 0; + let mut packed_bytes = 0; + { + let mut db = figcraft_text::db().write().unwrap(); + *db = figcraft_text::FontDb::default(); + for (family, style) in faces { + let font = figcraft_text::CRAFT_FONTS.iter().find(|f| f.family == family && f.style == style).expect("manifest face is embedded"); + // Run the build-time compressor and the exact WASM decoder before shaping. + let source = packed_dir.0.join("face.ttf"); + std::fs::write(&source, font.bytes).unwrap(); + let (packed, len) = pack_font(&source, &packed_dir.0).unwrap(); + let packed = std::fs::read(packed).unwrap(); + packed_bytes += packed.len(); + if family != "Noto Sans Arabic" { + prior_raw_bytes += font.bytes.len(); + } + let decoded = embedded::unpack(&packed, len).unwrap(); + assert_eq!(decoded, font.bytes); + db.add(Face::from_bytes(FontBytes::Shared(std::sync::Arc::new(decoded)), 0, Some(font.family), Some(font.style)).unwrap()); + } + } + + if has_all_inter_styles { + assert!(packed_bytes < prior_raw_bytes, "including Arabic must not grow the embedded web font payload"); + } + eprintln!("web font payload: {packed_bytes} compressed bytes including Arabic; {prior_raw_bytes} raw bytes before Arabic"); + + for family in ["Iran Sans", "Inter"] { + for characters in ["۴۵,۰۰۰ تومان به کیف پول بومرنگ شما واریز شد.", "مرحبا بالعالم ١٢٣"] { + let mut text = figcraft_doc::TextData::new(characters); + text.style.font_family = family.into(); + let layout = figcraft_text::layout(&text, None, None); + assert!(!layout.glyphs.is_empty()); + assert!(layout.glyphs.iter().all(|g| g.gid != 0), "missing glyphs for {family}: {characters}"); + assert!(layout.glyphs.iter().any(|g| g.face.family == "Noto Sans Arabic")); + assert!(layout.lines.first().unwrap().rtl, "Arabic/Persian paragraphs run right to left"); + if characters.starts_with('۴') { + let x = |at| layout.glyphs.iter().find(|g| g.char_start == at).unwrap().x; + assert!(x(0) < x(5), "Persian digits keep their left-to-right order inside the RTL paragraph"); + } + } + let mut joined = figcraft_doc::TextData::new("بب"); + joined.style.font_family = family.into(); + let layout = figcraft_text::layout(&joined, None, None); + assert!(layout.glyphs.iter().all(|g| g.gid != g.face.glyph_for('ب')), "adjacent Arabic letters use joined forms"); + } +} diff --git a/docs/localization-parity.md b/docs/localization-parity.md index c3490a195..81028865d 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (a right-to-left UI language (Arabic) mirrors the window: the icon rail and layers panel on the right, the Design panel on the left, popovers beside it over the canvas, egui's scroll bars, submenus and checkboxes mirrored; `FIGCRAFT_EMBED_SCRIPTS` embeds other scripts' craft-fonts faces in a web build, so Arabic and Persian documents draw there (#1902); documents: a paragraph's base direction can be forced with Text ▸ Text direction, as Add right-to-left text says (#1830); Bosnian draft catalog, one/few/other plurals; German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; partial review, catalog remains a draft; Arabic draft catalog, count-neutral plurals and web font gate; Thai draft catalog and Thai UI fonts; a missing translation fails no check: `cargo xtask i18n-report` lists them; Vietnamese draft catalog; string counts re-measured: 2,352 entries; Russian and Turkish catalogs reviewed by native speakers, Russian one/few/many plurals; Czech and Indonesian drafts; the Japanese draft completed; counts re-measured; Windows UI language from the first preferred language; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog; macOS finds its downloadable CJK system fonts (#406); string counts re-measured: 2,272 entries, the drafts at 95–99%; Swedish command labels and menu wordings; Russian, Swedish, Turkish, Czech and Indonesian listed; a duplicated paragraph removed) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (a right-to-left UI language (Arabic) mirrors the window: the icon rail and layers panel on the right, the Design panel on the left, popovers beside it over the canvas, egui's scroll bars, submenus and checkboxes mirrored; web builds with craft-fonts embed Noto Sans Arabic Regular by default, and required web builds reject catalogs without it, so Persian and Arabic documents draw without extra build flags (#1902); other scripts remain opt-in with `FIGCRAFT_EMBED_SCRIPTS`; documents: a paragraph's base direction can be forced with Text ▸ Text direction, as Add right-to-left text says (#1830); Bosnian draft catalog, one/few/other plurals; German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; partial review, catalog remains a draft; Arabic draft catalog, count-neutral plurals and web font gate; Thai draft catalog and Thai UI fonts; a missing translation fails no check: `cargo xtask i18n-report` lists them; Vietnamese draft catalog; string counts re-measured: 2,352 entries; Russian and Turkish catalogs reviewed by native speakers, Russian one/few/many plurals; Czech and Indonesian drafts; the Japanese draft completed; counts re-measured; Windows UI language from the first preferred language; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog; macOS finds its downloadable CJK system fonts (#406); string counts re-measured: 2,272 entries, the drafts at 95–99%; Swedish command labels and menu wordings; Russian, Swedish, Turkish, Czech and Indonesian listed; a duplicated paragraph removed) · **Target:** Figma Design (desktop app 126.10.7) FigCraft's interface has a localization layer with an English catalog, a Russian catalog reviewed by a native speaker, and Spanish (with a Latin American overlay), French, German, Brazilian @@ -96,11 +96,14 @@ supported by both apps (CJK, Arabic and Devanagari shaping, IME); Figma has no v embeds Noto Sans CJK SC (+16 MB) and offers Japanese, Korean and Simplified Chinese; without a Noto Sans CJK TC face built in it leaves Traditional Chinese out too; otherwise the language picker and System leave them out. No font file is in this repo. - embeds Noto Sans CJK SC (+16 MB) and offers Japanese, Korean and Simplified Chinese; otherwise the language picker and - System leave them out. `FIGCRAFT_EMBED_SCRIPTS=Arab,Hebr,Thai,Deva` (one tag per script wanted, as - the craft-fonts manifest lists them) embeds those scripts' faces as well, so an Arabic or Persian - document draws in Noto Sans Arabic (+0.8 MB) instead of missing-glyph boxes (#1902), and with `Arab` - the picker offers the Arabic UI catalog too, as on the desktop. No font file is in this repo. +- **Arabic and Persian on the web:** builds with craft-fonts embed Noto Sans Arabic Regular by + default, so documents have an Arabic-script fallback and the picker offers the Arabic UI without + extra build flags (#1902). Required web builds reject a catalog without that face. Web fonts are packed + losslessly at build time and restored once at runtime to preserve the WASM size budget; other + scripts remain optional through + `FIGCRAFT_EMBED_SCRIPTS=Hebr,Thai,Deva` (one tag per script wanted, as the manifest lists them). + Noto Sans Arabic is a fallback: matching Iran Sans exactly still needs that installed font via + local font access in a browser that supports it. No font file is added to this repository. ## Languages @@ -111,10 +114,8 @@ supported by both apps (CJK, Arabic and Devanagari shaping, IME); Figma has no v | Traditional Chinese (Taiwan) | zh-Hant | 2,647 / 2,647 (100%: 1,975 UI strings, 641 command labels, 31 menu wordings; draft, counted 2026-11-03) | yes | CJK text and IME in documents; UI text in an installed Noto Sans CJK TC, then Microsoft JhengHei, PingFang TC or Heiti TC (web: only with a built-in TC face); zh-TW, zh-HK, zh-MO and zh-Hant read it, an explicit Hans stays Simplified | no | draft | 1–2 (after native review) | | Spanish | es, es-419 | 2,352 / 2,352 (100%, draft); es-419 overlays 104 Latin American wordings (draft) | yes | Latin | no | draft | 0–1 (after native review) | | Hindi | hi | 0 (0%) | no | Devanagari shaping works in documents; UI font fallback to check | no | none | 4–7 | -| Arabic | ar | 1,857 / 1,857 UI strings, 620 command labels, 31 menu wordings (draft, counted 2026-10-28) | catalog complete; native review pending | Existing bidi/shaping and Arabic system fallback; web: only a build with `FIGCRAFT_EMBED_SCRIPTS=Arab` embeds Noto Sans Arabic (the font budget leaves it out otherwise, #1902); documents draw in it and the picker offers the Arabic UI then; panels do not mirror | no | draft | review + panel mirroring (not re-estimated) | +| Arabic | ar | 1,857 / 1,857 UI strings, 620 command labels, 31 menu wordings (draft, counted 2026-10-28) | catalog complete; native review pending | Existing bidi/shaping and Arabic system fallback; web builds with craft-fonts embed Noto Sans Arabic by default for documents and the Arabic UI (#1902); the window mirrors (panels swap sides), rows inside the panels do not | no | draft | review + mirrored panel rows (not re-estimated) | | Hindi | hi | 0 (0%) | no | Devanagari shaping works in documents; the desktop UI takes an installed Devanagari face (Nirmala UI, Kohinoor Devanagari, Noto Sans Devanagari, Lohit) for names and values (#2014); no UI catalog | no | none | 4–7 | -| Arabic | ar | 1,857 / 1,857 UI strings, 620 command labels, 31 menu wordings (draft, counted 2026-10-28) | catalog complete; native review pending | Existing bidi/shaping and Arabic system fallback; web not offered (font budget excludes Arabic); panels do not mirror | no | draft | review + panel mirroring (not re-estimated) | -| Arabic | ar | 1,857 / 1,857 UI strings, 620 command labels, 31 menu wordings (draft, counted 2026-10-28) | catalog complete; native review pending | Existing bidi/shaping and Arabic system fallback; web not offered (font budget excludes Arabic); the window mirrors (panels swap sides), rows inside the panels do not | no | draft | review + mirrored panel rows (not re-estimated) | | French | fr | 2,328 / 2,352 (99.0%, draft) | yes | Latin | no | draft | 1–2 (after native review) | | Portuguese | pt-BR | 2,331 / 2,352 (99.1%, draft) | yes | Latin | no | draft | 1–2 (after native review) | | Indonesian | id | 2,292 / 2,352 (97.4%, draft) | yes | Latin | no | draft | 1–2 (after native review) | @@ -149,6 +150,7 @@ Hindi and Arabic. | Date | Change | Summary | |---|---|---| +| 2026-11-07 | patch | M10, #1902: Noto Sans Arabic Regular joins the default web font catalog, so Persian and Arabic documents no longer need `FIGCRAFT_EMBED_SCRIPTS=Arab`. Required web builds fail if the face is missing; web fonts are packed losslessly and restored once at runtime to preserve the WASM size budget. Other script fonts stay optional. Exact Iran Sans rendering requires that installed font through supported browsers' local font access. Existing duplicate Arabic rows and the repeated web-font paragraph are consolidated, preserving the mirrored window and pending panel-row mirroring. Grades and estimates unchanged. | | 2026-11-03 | minor | Traditional Chinese (Taiwan) (`zh-Hant`, 繁體中文(台灣)) draft catalog: every UI string (1,975), command label (641) and menu wording (31), translated clean-room from the English source and marked as a draft awaiting native review. `zh-TW`, `zh-HK`, `zh-MO` and `zh-Hant` read it; an explicit Hans still reads Simplified Chinese. The desktop UI prefers an installed Noto Sans CJK TC, then Microsoft JhengHei, PingFang TC and Heiti TC; no font is bundled. No plural forms. Localization grade and estimates unchanged | | 2026-11-03 | patch | M10, #1902: the web build drew Persian and Arabic text as missing-glyph boxes. The browser has no system fonts, and `crates/text/build.rs` keeps the web catalog to Inter, Noto Sans Georgian, the wordmark and (with `FIGCRAFT_EMBED_CJK`) Noto Sans CJK, so craft-fonts' Noto Sans Arabic never reached it. `FIGCRAFT_EMBED_SCRIPTS=Arab,Hebr,…` (script tags as the manifest's scripts column lists them) now embeds those scripts' faces in a web build; the default build and its size are unchanged, and with `Arab` embedded the picker offers the Arabic UI as well (`cjk::can_show`, as on the desktop). Noto Sans Hebrew, Devanagari and Georgian join Arabic and Thai among the document fallbacks, so an embedded face draws its script in an Inter document. Tests: `web_embeds_other_scripts_faces_only_when_asked` in the build script, `every_embeddable_script_face_is_a_document_fallback`. | | 2026-11-05 | patch | #2014: the panels drew a String variable's Amharic value as boxes: the UI took a system face for Hebrew and Arabic only. `bidi::script_fallbacks` now samples one letter of each of 16 scripts (Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as well as Hebrew and Arabic; Bengali and Thai keep `crate::cjk`'s faces) against the system's families for each (Windows, macOS, the common Linux fonts), the first installed one that draws the letter taken once. Desktop only: the web build has no system fonts. Test: `bidi::tests::other_scripts_take_an_installed_system_face` (skips scripts the machine has no face for). | diff --git a/docs/translating.md b/docs/translating.md index 6eb472281..18158ba07 100644 --- a/docs/translating.md +++ b/docs/translating.md @@ -87,16 +87,17 @@ Traditional Chinese is left out unless that build has a Noto Sans CJK TC face. A Chinese UI puts its Chinese face first so Han takes Simplified Chinese shapes, and a Traditional Chinese UI puts an installed Noto Sans CJK TC first, then the system's Taiwan faces (Microsoft JhengHei, PingFang TC, Heiti TC), so Han takes Traditional shapes. No font is added to this -repository. Georgian is drawn in -`FIGCRAFT_EMBED_CJK=1` (Noto Sans CJK SC, +16 MB); otherwise they are left out of the picker. The other -scripts' faces (Noto Sans Arabic, Hebrew, Thai, Devanagari) join a web build only with -`FIGCRAFT_EMBED_SCRIPTS=Arab,Hebr,Thai,Deva` (one tag per script wanted, as the manifest lists them), for -documents in those scripts; with `Arab` embedded the picker offers Arabic too (#1902). A -Chinese UI puts its Chinese face first so Han takes Simplified Chinese shapes. Georgian is drawn in -craft-fonts' Noto Sans Georgian, one of the built-in faces in `theme::install_fonts`, or else in an -installed font on the desktop. Web builds keep it only when the craft-fonts they're built with has -it (`crates/text/build.rs`); the commit releases pin doesn't yet (`docs/releasing.md`), so the web -picker leaves Georgian out. A new CJK or other non-Latin language also needs its script in +repository. + +Web builds with craft-fonts embed Noto Sans Arabic Regular by default for Persian and Arabic +documents, and the picker offers Arabic without extra build flags (#1902). Required web builds +reject a catalog without that face (`crates/text/build.rs`). Web faces are compressed losslessly +at build time and restored once at runtime to preserve the WASM size budget. Additional script +faces (Noto Sans Hebrew, Thai, Devanagari) join a web build with +`FIGCRAFT_EMBED_SCRIPTS=Hebr,Thai,Deva` (one tag per script wanted, as the manifest lists them). +Georgian is drawn in craft-fonts' Noto Sans Georgian, one of the built-in faces in +`theme::install_fonts`, or else in an installed font on the desktop. Required web builds also +require Noto Sans Georgian Regular. A new CJK or other non-Latin language needs its script in `cjk::language`, or a built-in craft-fonts face. ## Arabic draft @@ -112,10 +113,12 @@ This is deliberate: the current plural `Forms` have no zero/two fields. It is no of Arabic's six CLDR categories; wording remains valid for 0, 1, 2 and larger integer counts. Arabic text uses the existing bidi/shaping and Arabic system-font fallback on desktop. Web builds -require an embedded Noto Sans Arabic face to offer Arabic. The current web font budget filters -that face out, so Arabic is not offered on the web yet. No font is added to -this repository. The interface's panels are not mirrored; this catalog does not claim a complete -right-to-left interface. Native review and representative in-app checks remain required. +with craft-fonts include Noto Sans Arabic by default and offer Arabic. This fallback makes Persian +and Arabic text readable; matching Iran Sans exactly still requires that installed font. In a +browser that supports local font access, choose “Use fonts installed on this computer…” in the +Design panel's font menu and grant the browser's permission. No font is added to this repository. +The window mirrors (the panels swap sides), but rows inside the panels keep their left-to-right +order. Native review and representative in-app checks remain required. ## Traditional Chinese (Taiwan) draft