Files

RustFig's own formats are xfig's Fig files (.fig, Fig 3.2 on writing) and .rustfig (a lossless JSON version of the same drawing). RustFig reads Fig 1.3 to 3.2, so old figures open too; warnings appear in the message panel where an old file needed repairs.

Autosave and recovery

While you work, RustFig writes a recovery copy of any drawing with unsaved changes a few seconds after the last change. If the program stops without saving (a crash, power loss, a killed process), the next start offers to restore each drawing it finds, or discard it. After a normal save or exit the copy is removed. Restore a drawing, check it and save it where you want.

In the browser the copy goes to the browser's local storage (as Fig text, drawings up to 2 MB). Reload the page and RustFig offers to restore it or discard it; saving the drawing or starting a new one removes the copy. Clearing the site's data, or a private window, loses it, so download (File > Save) what matters.

Saved versions. Each time you save, RustFig keeps the file it replaces in the recovery folder. File > Saved versions… lists the last versions of the open file with their times; Restore puts one back as the open drawing (save it to keep it). Global settings > Saved versions kept sets how many (default 5, 0 switches it off, at most 50). Versions are kept only where the recovery folder is available (native app). The commands are file.versions and file.restore_version.

Starting from the command line

Running rustfig FILE.fig opens a file at start. See Automation.

Opening from the file manager (macOS)

Double-clicking a .fig file in Finder, choosing Open With > RustFig, open -a RustFig FILE.fig or dropping a file on the Dock icon opens it, whether RustFig is already running or is started by it. As with File > Open, RustFig asks before it discards unsaved changes; several files sent at once open one after the other.

The web version

RustFig also runs in a browser (WebAssembly). Build it with cargo xtask web (needs trunk: cargo install --locked trunk) and serve the dist/ folder with any static web server, or run cargo xtask web --serve and open http://127.0.0.1:8080. The page shows "Loading RustFig…" until the program has started.

In the browser there are no file paths. File > Open shows the browser's file picker (a Fig file, a PDF or SVG to import, or a PDF, SVG or PNG export with the figure embedded); you can also drop such a file on the window. File > Save and Save As download the figure as a file named after the open one (figure.fig for a new figure; the browser decides the folder), and File > Export downloads each exported file. The menu leaves out what only makes sense on the desktop: Open and Merge with preview, Digitize, Capture Screen, New window, Saved versions and Exit.

File > Merge (Alt+M) shows the same picker and adds the picked figure as one compound, as on the desktop.

Pictures in the browser. Picture mode, Import picture and the picture panel's Browse/Relink show the browser's picker too (a figure's pictures can also be dropped on the picture panel). The browser gives RustFig the picture's bytes, not a place on disk, so RustFig keeps them in memory under the file name for as long as the page stays open, and the figure stores only that name, as always. After you reload the page, or when you open a .fig that names pictures, the pictures are empty boxes with their names until you pick them again (Reread in the picture panel, or Relink: pick the file with the same name). Saving the figure downloads only the .fig; keep the picture files next to it to see them on the desktop. Exports made in the browser (File > Export) do not contain these pictures yet. EPS, PDF and compressed pictures need the desktop version: the browser build reads PNG, JPEG, GIF, BMP, PNM and TIFF.

Libraries in the browser. Library mode works with the bundled libraries, which the page serves as files next to the program (see Libraries). The Source line reads "bundled libraries" (there is no folder to choose).