xfig for today's computers: the classic vector drawing program in Rust for macOS, Windows, Linux and the web, with fig2dev and LaTeX built in
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗xfig for today's computers. The classic vector drawing program, rebuilt in Rust for macOS, Windows, Linux and the web, with fig2dev built in: a modern xfig that runs natively on Windows and macOS, with no X server, XQuartz or WSL.
Website: https://fabianhassler.github.io/rustfig/ (overview, downloads, the manual, a comparison with xfig and other programs, and the web app).
.fig files: RustFig opens every Fig version and saves Fig 3.2 that
xfig and fig2dev read unchanged.fig2dev command line comes along.Download RustFig
for macOS, Windows or Linux, or install it with Homebrew; see
Installation. Or try it in your browser,
nothing to install (a preview: drawings stay in your browser until you save
them as a download, and a few exports need the desktop app). The drawing above is
docs/images/rustfig-window.fig.
Each release on the Releases page has ready-made apps (not yet signed by Apple or Microsoft):
| System | File | How |
|---|---|---|
| macOS (Apple silicon) | RustFig-VERSION-macos.dmg | Drag RustFig to Applications. The app is not notarized by Apple yet, so the first start is refused: open System Settings > Privacy & Security and click Open Anyway (or run xattr -dr com.apple.quarantine /Applications/RustFig.app once). .fig files then open with a double-click. |
| Windows | rustfig-VERSION-windows.zip | Unpack anywhere and start rustfig.exe. fig-association.reg makes .fig files open in RustFig. Or with Scoop: scoop install https://raw.githubusercontent.com/FabianHassler/rustfig/main/packaging/scoop/rustfig.json |
| Linux (x86-64 and ARM64) | .deb or .tar.gz | sudo apt install ./rustfig_VERSION_amd64.deb (_arm64.deb on ARM, e.g. a Linux VM on an Apple-silicon Mac), or unpack the .tar.gz and run install.sh; both register the .fig file type. The .deb leaves the name fig2dev to Debian's fig2dev package: run RustFig's as rustfig fig2dev …. |
The tap FabianHassler/homebrew-tap
builds rustfig and rustfig-cli from source (rustfig fig2dev … runs
fig2dev's command line); fig2dev-rs adds a plain fig2dev command.
brew install fabianhassler/tap/rustfig
brew install fabianhassler/tap/fig2dev-rs # optional: `fig2dev`
Update with brew upgrade rustfig, remove with
brew uninstall rustfig. Homebrew's own fig2dev formula (the C program)
installs the same command name as fig2dev-rs: keep one of them linked.
Rust 1.92 or newer from rustup (rustup update
brings an older one up to date).
Linux only: the libraries the window system needs, e.g. on Debian/Ubuntu:
sudo apt install pkg-config libgtk-3-dev libxkbcommon-dev libwayland-dev \
libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
macOS and Windows need nothing extra.
Install both programs (rustfig, the drawing program, and
rustfig-cli, the command line) straight from GitHub, the latest release:
cargo install --locked --git https://github.com/FabianHassler/rustfig --tag v0.9.0-beta.9 rustfig rustfig-cli
Leave out --tag … for the latest main. RustFig is not on crates.io
(a plain cargo install rustfig does not work); the --git line builds
the same program. Cargo fetches fig2dev, the converter RustFig exports
through, by itself.
Or from a clone:
git clone https://github.com/FabianHassler/rustfig
cd rustfig
cargo install --locked --path apps/rustfig
cargo install --locked --path apps/cli
The programs go into ~/.cargo/bin (Windows: %USERPROFILE%\.cargo\bin),
which rustup puts on your PATH. Update later by rerunning the --git line
with a newer --tag (or --force for main), or with git pull and the two
--path lines; remove with cargo uninstall rustfig rustfig-cli.
rustfig drawing.fig # draw
rustfig-cli convert drawing.fig drawing.pdf # convert without opening a window
rustfig-cli formats # list the export languages
rustfig-cli mcp # MCP server for AI assistants
Tool shortcuts follow xfig: C circle, E ellipse, L polyline,
P polygon, B box, I spline, R arc, T text, M move, D delete,
S select. Left click adds points; double click, right click or Enter
finishes; Esc cancels. Without a three-button mouse: Option/Alt + click is the
middle button, and on macOS Ctrl + click the right one (on Linux and Windows,
left and right pressed together also give the middle button). The full manual
is in the program (Help > RustFig Manual, F1) and
on the web.
Fonts: RustFig draws text with the fonts installed on your system (Times,
Helvetica, Courier, Symbol, Palatino, … or their URW/TeX Gyre clones) and
falls back to built-in fonts. Help > Install TeX Gyre fonts… downloads the
metric-compatible TeX Gyre fonts from CTAN (checked by SHA-256, nothing is
bundled). FIG2DEV_BUILTIN_FONTS=1 forces the built-in fonts.
Beta (pre-releases 0.9.0-beta.N). Overall xfig parity ≈95 % (see ROADMAP.md and the parity assessment).
RustFig includes fig2dev, xfig's converter, ported to Rust: the same command line, options, messages and exit codes as fig2dev 3.2.9a, without ghostscript or other helper programs. Use it three ways:
rustfig fig2dev -L pdf drawing.fig drawing.pdf # through the rustfig program
rustfig-cli fig2dev -L eps drawing.fig drawing.eps # or rustfig-cli
fig2dev -L svg drawing.fig drawing.svg # under its own name (see below)
Common uses (all of fig2dev's options are accepted; rustfig fig2dev -h lists
the general ones, rustfig fig2dev -h -L LANG adds the language's own):
rustfig fig2dev -L pdf -m 0.5 in.fig out.pdf # half size
rustfig fig2dev -L png -m 2 -S 4 in.fig out.png # bitmap, double size, smoothed
rustfig fig2dev -L pdftex in.fig out.pdf # graphics for LaTeX ...
rustfig fig2dev -L pdftex_t -p out.pdf in.fig out.pdf_t # ... and the text part
rustfig fig2dev -L tikz in.fig out.tex # TikZ picture
rustfig fig2dev -L eps -D +10,20 in.fig out.eps # only depths 10 and 20
cat in.fig | rustfig fig2dev -L svg > out.svg # stdin to stdout
Languages: PostScript, EPS, PDF, SVG, PNG, GIF, JPEG, TIFF, PPM, PCX, XBM,
XPM, LaTeX picture, epic, eepic, eepicemu, PiCTeX, TeXtyl, tpic, pic,
pstex/pdftex/pspdftex, pict2e, TikZ, PSTricks, LaTeX box, CGM, HPGL, DXF,
MetaPost, METAFONT, ge, image map, Gerber, shape, EMF, Tk, Perl-Tk and
AutoCAD slides (sld).
As fig2dev for old scripts and Makefiles: the rustfig program behaves
as fig2dev when it is started under that name, so a link is enough:
ln -s ~/.cargo/bin/rustfig ~/.local/bin/fig2dev # any directory on PATH
On Windows copy rustfig-cli.exe to fig2dev.exe instead (the GUI program
has no console window for messages). If the C fig2dev is installed too, the one
that comes first on PATH runs (which -a fig2dev shows both). fig2dev can
also be installed on its own, without RustFig: see
its README.
Pictures inside figures: PDF pictures stay vectors in PDF, PostScript and
EPS output. EPS pictures are copied into PostScript/EPS output; for PDF and
bitmap output they need ghostscript (gs) installed, otherwise their preview
image is used.
RustFig keeps what makes xfig good: its simplicity and its full functionality. Every xfig mode, button and option stays, and works the way xfig users expect.
Additions must respect xfig. They fit into xfig's way of working (its modes, its three mouse buttons, its panels) and don't change what an existing xfig action does. Departing from xfig needs a good reason, for example printing, which no longer works the old way on today's systems. A modern look is fine; a different program is not.
The Fig file format stays fully backward compatible. RustFig reads every Fig version xfig reads and saves Fig 3.2 that xfig and fig2dev open unchanged. A feature RustFig adds must fit inside the format (for example in an object's comment, with a plain Fig fallback), never extend or break it.
From the source tree without installing:
cargo run --release -p rustfig -- drawing.fig. cargo xtask ci runs the
quality gates (format, lints, tests, layering, asset and license checks, the
web build); cargo xtask package builds the app bundle for your system;
cargo xtask web builds the web version. See Development
and Architecture.
Architecture · Development · MCP · Gaps · Milestones
Code is licensed under MIT OR Apache-2.0 (LICENSE-MIT, LICENSE-APACHE). Parts ported from xfig and fig2dev also carry the xfig license notice (LICENSE-xfig).
See NOTICE and ASSETS.md.