JFLib

JFLIB#

jflib.org · Discord · Apps on jfreund.org

A GUI library in Rust, with its own renderer, interchangeable styles, and apps built on top.

The library is designed to be used by AI Agents, not by Humans – Thus the entire Codebase is optimized for hardware efficiency.

JFLIB brings widgets, layout, text, 2D graphics, image formats, and platform integration together in one library. This repository contains both the library and its applications: from small GUI examples to Kritzel, jfWord, and the Build Manager. JFPainter, the image editor formerly called PaintCraft, has its own repository, JFLibrary/JFPainter; so do the network simulator JFNetworker, JFLibrary/JFNetworker, and its scripting language JFScript, JFLibrary/JFScript. The Rust code uses #![no_std], core, and alloc; an app of its own may use std and std crates (the feature std of jflib, docs/GUIDE.md). Cargo builds the library and the apps, with cargo run on Windows, Linux and macOS alike; a Python script (build_rs.py) runs this repository's tests and checks. Complex text shaping uses pinned HarfRust and Unicode crates; these are statically linked. See the dependency notices.

cargo install cargo-jflib     # once
cargo jflib new hello         # a window app with its test
cd hello
cargo run

The app's one dependency is the crate jflib, its documentation is on docs.rs. More under Your own app with Cargo.

Kritzel displaying a JFLIB sample drawing created in the app

Library · Feature tour · Platforms · Apps · Your own app with Cargo · Build the apps · Build Manager · Rust examples · Styles · Documentation

The library#

An app describes its interface in App::frame. JFLIB handles layout, input, focus, and rendering, while the app keeps its state in a Rust struct. Widgets are drawn by the selected style, so the same interface can be built with different appearances without changing the application logic.

  • Widgets and layout: buttons, checkboxes, switches, text fields, sliders, lists, tabs, menus, dialogs, scroll areas, toolbars, Office ribbons, a grid box, docking panels in tab groups and floating tool windows, and popups and tooltips that may leave the window.
  • Data views and app shells: virtualized grids with sorting and multiple selection, trees, navigation panes, command bars, splitters, wizards, charts, toasts, date and time inputs, a diagram canvas (nodes, ports, edges, minimap), and a terminal widget, drawn by every style.
  • Editors: a rich-text editor with a formatting toolbar and HTML in and out, a code editor with syntax highlighting for Rust, JSON, INI, TOML, and Markdown that stays fast with 100,000 lines, and an undo history for the app's own documents.
  • Custom rendering: a software renderer for text, paths, shapes, gradients, image compositing, and effects, with scalable interfaces and light and dark themes; SVG images and icons that stay sharp at every size, an image viewer with zoom and pan, and easing curves for animations.
  • Text and fonts: OpenType shaping and bidirectional text, glyph fallback across fonts, font aliases and per-language fonts without fontconfig, a font picker and font dialog, Unicode grapheme, word, and line segmentation, hyphenation, subpixel (ClearType-like) smoothing, spell checking with Hunspell dictionaries or the Windows spell checker, and input methods on Windows, Wayland, and X11.
  • Accessibility: screen readers through UI Automation, AT-SPI2, VoiceOver on macOS and iOS, an ARIA tree in the browser, and Android's accessibility nodes; the system's high contrast, accent color, reduced motion, and text size (a text scale separate from the UI scale); full keyboard operation (focus groups, F6 through panes, the menu key everywhere); the caret position for screen magnifiers.
  • Languages and regions: the library's own texts in nine languages (German, English, French, Spanish, Italian, Dutch, Polish, Arabic, and Hebrew), plural rules, regional number and date formats, mirrored layouts for right-to-left languages, and sorting by language.
  • Desktop integration: one instance per app, file types and URL schemes, system notifications and a notification-area icon, drag and drop between widgets and other programs, taskbar progress, badges, and jump lists, starting at login, keeping the system awake, the monitor list (work areas, DPI, refresh rates), global shortcuts, a colour picked anywhere on the screen, and pictures of the screen.
  • Sound: output streams with a target latency on every platform (WASAPI, the PulseAudio protocol that PipeWire serves, WebAudio, AAudio), short sounds from WAV and Ogg Vorbis files mixed together, and the system's own sounds for events and message dialogs.
  • Files, permissions, and updates: one file namespace (app://, config://, data://, cache://, mem://, ZIP archives, overlays), assets built into the program, a PERMISSIONS manifest per app enforced at run time with questions to the user, the system's secret store, signed updates with rollback, code signing, and packages from the Windows setup and .deb to AppImage, Flatpak, MSIX, and RPM.
  • App framework: logging, lifecycle hooks, typed settings with a generated settings page, saved window state, widget ids from names, and async tasks in the event loop.
  • Images and documents: built-in image codecs, including PNG, JPEG, WebP, TIFF, AVIF, JPEG XL, and JPEG 2000, plus shared document, layout, and DOCX components for jfWord.
  • PDF, tables and drawings: a vector PDF writer and a reader that shows pages, fills in forms and changes files (pdf); Excel workbooks and CSV (sheet_io); DXF drawings (dxf); Visio's files with their model (diagram_core, diagram_io, diagram_view); JSON, XML and text encodings (formats).
  • 2D for CAD, 3D and games: a 2D renderer for large drawings with snapping, also without a GPU (render2d), a 3D engine with glTF import (render3d, gltf), and young building blocks for games: game, physics, geom, netchan.
  • Shared UI core: native desktop windows, the browser host, and the Android adapter use the same Rust widgets and renderer.
  • Networking and security: an HTTP/1.1 server and client, TLS 1.3 (private CAs, and a TLS 1.2/1.3 client for public servers with X.509 path building and the system's trust store), certificates from ACME authorities such as Let's Encrypt, OCSP, WebSocket, SMTP, an SSH-2 client, DNS with DNSSEC, DoT and DoH, cryptography (BLAKE3, Argon2id, ChaCha20-Poly1305, AES-GCM, X25519, Ed25519, RSA, ECDSA), LZ4 and zstd, an embedded journal database, and deduplicating encrypted repositories -- written for BackupJF, usable by any program. Packet codecs from Ethernet to TCP with a dissector and pcapng files (netpkt) for simulators and tools.
  • App automation and debugging: built-in PNG screenshots, widget dumps, .uis scripts, a live inspector (--inspect, Ctrl+Shift+I or F12) with an overlay and the widget tree, and optional JSON/MCP control that must be explicitly enabled.
  • Modular design: dedicated .rlib components expose safe APIs to applications. unsafe is confined to the runtime, platform, SIMD, GPU and module boundaries.

JFLIB grew out of the Rust rewrite of jfguiLib. Some identifiers, window titles, and text in the apps and detailed documentation still use the earlier name or refer to the original assembly version.

Feature tour#

Newer parts of the library, captured from the demo and test apps named above each picture (cargo run in apps/NAME starts them). The roadmap shows what is done and what is still missing; the changelog lists the changes of each version (0.1.0 is the first on crates.io).

Charts and data views (datagallery)Diagram canvas (diagramtest)
A data view with KPI cards and sparklines, a stacked bar chart, a donut chart, a sortable grid, a wizard, and a toastA diagram with nodes, ports, straight and curved edges, a selection, a grid, and a minimap

KPI cards with sparklines, a stacked bar chart, a donut, a sortable grid, steps of a wizard, and a tree with check boxes; the diagram canvas with nodes and ports, straight, curved, and right-angled edges, snapping to the grid, and a minimap.

Rich-text editor (editortest)Code editor (editortest)
The rich-text editor with headings, character formats, lists, a quotation, and alignmentsThe code editor showing Rust with syntax highlighting in the dark theme

Headings, character formats, colors, fonts, lists, quotations, and alignments, with HTML in and out; syntax highlighting, line numbers, find and replace, shown here in the dark theme.

Drag and drop (dndtest)Docking panels (docktest)
An apple dragged into a highlighted basket, with the drag label at the pointerDocked panels in tab groups with drop markers while a panel is dragged

A drop target lights up and the dragged item follows the pointer; text, HTML, URLs, images, and files also travel to and from other programs. Panels sit in tab groups, show drop markers while they are dragged, float as tool windows, and keep their layout.

High contrast (datagallery --contrast high)Text scale 150 % (gallery --text-scale 150)
The data view in the high-contrast themeThe widget gallery with text at 150 percent while icons keep their size

Both follow the system's settings by default. The text scale enlarges text and line heights independently of the UI scale.

SVG images (svgtest)Live inspector (gallery --inspect)
SVG test pictures: shapes, paths, strokes, gradients, transforms, clip paths, opacity, CSS, use, text, and imagesThe inspector's overlay naming the button under the pointer with its id, label, size, and state

SVG files drawn by JFLIB's own rasterizer, and symbols in the text color at several sizes; the inspector names the widget under the pointer and opens a tool window with the widget tree, properties, a script selector, and frame statistics.

Spell checking (spelltest)Font dialog (fontpicktest)
A misspelled word in a text field with suggestions in its context menuThe font dialog with a search field, styles, sizes, and a preview

Misspelled words are underlined while typing, and the context menu offers suggestions and the user's dictionary; the font dialog searches the installed fonts and previews the choice.

Platforms#

The following table describes the build paths available in the current repository:

PlatformOutput / build targetStatus
WindowsNative x86-64 and ARM64 app, --target win (--arch aarch64)Win32 windows and desktop integration; ARM64 checked on GitHub's windows-11-arm runner, not yet on a device of its own (ARM64 plan)
LinuxNative x86-64 and ARM64 app, --target linux (--arch aarch64)Wayland and X11; the backend is selected at startup; ARM64 checked on GitHub's ubuntu-24.04-arm runner and in an ARM64 VM, GPU there only with lavapipe
AndroidNative APK, --target androidandroidGallery and jfWord, ARM64 and x86-64 emulator; Android 8 / API 26 or later; threads, network, files, printing and the system's fonts as on the desktop, tested on the emulator and an Android 16 phone, the emulator's run also as the workflow android.yml (Android plan)
macOSNative app for Apple silicon and Intel Macs, --target mac (--arch x86_64; built on a Mac)AppKit windows, menus, Dock, notifications and services; GPU through Metal; NAME.app and .dmg, updates of the whole bundle; one program for both processors, macOS 13 or later; Metal on an Intel Mac's GPU is built but not tested (Intel Mac plan); no sound yet
iOS, iPadOSNative ARM64 app, --target ios (built on a Mac; --sim for the simulator)androidGallery as an iPhone and iPad app: UIKit host, touch, the iPad's menu bar and pointer, Apple Pencil, keyboards, sensors, files, clipboard, GPU through Metal; iOS 16 or later
WebWebAssembly and a shared browser host, --target webIncludes template, gallery, Kritzel, and jfWord

The documented browser test matrix covers Chromium and Firefox. Separate Safari/iOS validation has not yet been documented here. The macos style is independent of the target platform: it can also be built into a Windows app, for example.

On Android the apps run on a Java host of their own (no Gradle): the system's file picker (Storage Access Framework, with access kept across restarts), persistent app storage, the system clipboard, printing through the system's print dialog (also "Save as PDF") and the system's fonts. Below the UI the library has the same services as on the desktop: real threads and the pool, sockets and TLS, the file system with folder watching, datastore and cas. What Android does not have answers as unsupported instead of failing to build: child processes, system services, updates outside the store, the tray symbol, global hotkeys and autostart (Android plan, "Bewusst nicht"). The Android documentation describes the host and its tests.

Apps#

The first column is the app's folder under apps/: cd apps/NAME, then cargo run.

AppDescriptionTargets
templateA click counter as a starting point for your own GUIsWindows, Linux, Web
galleryA widget gallery for exploring controls, layout, and stylesWindows, Linux, Web
KritzelA drawing app with brushes, shapes, text, selections, and layersWindows, Linux, Web
JFPainterAn image editor with layers, history, effects, many image formats, and native plugins; formerly PaintCraft, now in its own repository and built from the crate jflib on crates.ioWindows, Linux, Web
jfWordA word processor with a ribbon, page view, text styles, tables, references, and DOCX supportWindows, Linux, Web, Android
buildManagerA graphical build app for applications, styles, profiles, tests, and release packagesWindows, Linux
BackupCraftA backup suite: console, server (bc-server), agents (bc-agent), and bcctl; deduplicated, encrypted, signed backups with schedules, roles, and audit; copy jobs, replication with failover, continuous protection, tape, QEMU/KVM VMs with instant start and boot checks, volume images, a central view of several serversWindows, Linux
JFNetworkerA network simulator and lab for distributed systems, an alternative to Cisco Packet Tracer: a topology editor with cables and port choice, IOS-like and Linux consoles, ARP, IPv4, VLANs, DHCP, DNS, TCP and HTTP byte for byte, a step-by-step simulation mode with event list and packet view, pcapng export; German and English; now in its own repository, with JFScript for the scripts in its hostsWindows, Linux
androidGalleryA touch gallery with widgets, text input, and theme switchingAndroid; also Windows, Linux, and Web

jfWord is under active development; full Word feature coverage and file compatibility are not yet complete. Native plugins and operating-system services are more limited in the browser than on the desktop.

JFPainter (until November 2026 apps/PaintCraft here) imports PSD/PSB raster layers, offers bitmap brush tips, connects to G'MIC-Qt and runs original paint.net plugins through its own host. It lives in its own repository and builds against the crate jflib from crates.io like any app outside this repository.

JFPainter: dark WinUI style, with tools, colors, history, and layers

JFPainter with the JF drawing open and its tool windows visible

BackupCraft: the jobs page in the dark backupcraft style (demo data)

BackupCraft's backup jobs with status badges, the command bar, and the navigation pane

jfWord: the same document view in the light and dark jfOffice style

LightDark
jfWord with its ribbon, navigation pane, and academic document templatejfWord in the dark jfOffice style

The images on this page were captured from the Rust apps and the GUI examples below, using the built-in screenshot renderer on Windows. The Pocket Gallery image is a desktop preview of the shared Android UI code; the Build Manager displays its bundled sample catalog. The screenshots currently show German UI text; the code examples below use English labels.

Your own app with Cargo#

An app outside this repository needs one dependency, the crate jflib, and the tool cargo jflib for what Cargo does not do itself:

cargo install cargo-jflib
cargo jflib new hello        # a window app with its test
cd hello
cargo run                    # Windows, Linux and macOS alike
cargo jflib test             # run tests/*.uis
cargo jflib watch            # hot reload while you edit
cargo jflib package          # a setup for Windows and a .deb (--formats all: also MSIX, AppImage, RPM, Flatpak)

Both are on crates.io (jflib, cargo-jflib), the documentation of the library on docs.rs (docs.rs/jflib). The README of the crate jflib and of cargo-jflib describe both; docs/VERSIONING.md says what the crates promise.

The apps of this repository build the same way, with Cargo started in their folder: cd apps/gallery, then cargo run (Building the apps). cargo jflib is then the one of this repository, not the one from crates.io: cargo install --path lib/cargo_jflib.

Building the apps of this repository#

Cargo builds every app of this repository in its folder, the same on Windows, Linux and macOS:

cd apps/gallery
cargo run                                # build and start: target/debug/gallery (.exe on Windows)
cargo run -- --theme dark --scale 150    # everything after -- goes to the app
cargo build --release                    # opt-level 2 + LTO: target/release/

Prerequisites#

  • Rust installed through rustup, with rustc and cargo on your PATH. The code targets Rust 1.98.x.
  • Windows: what Rust's msvc toolchain always needs for the build scripts, the Visual Studio Build Tools.
  • Linux: a C compiler as cc (gcc or clang), as for any Rust program with a build script. A program with a window links against glibc; showing it needs a Wayland or X11 session, building it does not.
  • macOS: Xcode's command line tools, on Apple silicon.

The first build downloads the versions pinned in Cargo.lock from crates.io. Later builds use Cargo's cache; CARGO_NET_OFFLINE=true enforces offline use after that cache has been populated. No system HarfBuzz installation is needed. Keep the generated THIRD_PARTY_NOTICES.md and licenses/ folder with distributed binaries; every package format and the APK include them automatically. They list the third-party code, data, and fonts in JFLib with their licenses.

Other targets and packages#

rustup target add x86_64-pc-windows-msvc
python build_rs.py app gallery --target win
.\build\win\gallery.exe

Linux quick start#

rustup target add x86_64-unknown-linux-gnu
python3 build_rs.py app gallery --target linux
./build/linux/gallery

Displaying the Linux app requires an active Wayland or X11 session; building it does not require a display. Windows can also build Linux output when the Linux Rust target and ld.lld are installed. To run that output, the build script uses WSL, with Ubuntu-24.04 as the default distribution. Set jfgui_WSL_DISTRO to select a different distribution.

Start your own app#

python build_rs.py new hello --title "Hello"     # apps/hello: a window app that builds and passes its test
python build_rs.py test hello                    # build it, run apps/hello/tests/*.uis (Windows and Linux)
python build_rs.py run hello --target win

--kind console, --kind tool (a window plus a command line program on a shared crate) and --kind service (a background service) start other kinds of programs; --style kde picks the style. python build_rs.py new --lib NAME --deps rt,plat adds a library crate under lib/. Every app gets its sources, PERMISSIONS, PACKAGE (its own version=0.1.0), TARGETS, a smoke test and a README; the developer guide (section 2) explains them.

More apps and build options#

# Build individual apps
python build_rs.py app Kritzel --target win
python build_rs.py app Kritzel --target win
python build_rs.py app jfWord --target win

# Build Windows and Linux together; both Rust targets must be installed
python build_rs.py app jfWord --target both

# Build and launch; everything after -- is passed to the app
python build_rs.py run gallery --target win -- --theme dark

# Optimized build in build/release/win/
python build_rs.py app Kritzel --target win --release

# Build all apps for a target, or just the library components
python build_rs.py all --target win
python build_rs.py lib --target win
OptionEffect
--target win / linux / web / androidBuild one target; the app must support it
--target bothWindows and Linux; the default for app, lib, and all
--target allWindows, Linux, and Web where supported; Android is built separately
--arch aarch64Windows and Linux for ARM64, into build/win-arm64/ and build/linux-arm64/ (below)
--style kdeSelect a style; otherwise, use apps/NAME/STYLE, falling back to winui
--style winui,classic,macos,kde,jfofficeBuild several style variants in one invocation
--releaseOptimized build with LTO; output defaults to build/release/
--profile sizeRelease profile tuned for smaller output; writes to build/size/
--profile o2Optimized build without LTO; writes to build/o2/
--out build/my-buildUse a custom output directory, including for release builds
-j 8Limit the number of concurrent compiler processes

Development builds produce build/win/NAME.exe or build/linux/NAME. When building multiple styles, the path also includes the style, for example build/win/classic/gallery.exe. Selecting a single explicit style does not add this subdirectory. Builds are incremental, and warnings are treated as build errors. An app's loadable modules, such as codectest's jxlenc.dll or jxlenc.so, are built automatically.

Windows and Linux on ARM64#

rustup target add aarch64-pc-windows-msvc aarch64-unknown-linux-gnu
python build_rs.py app gallery --target both --arch aarch64    # build/win-arm64/, build/linux-arm64/
python build_rs.py test coretest --target linux --arch aarch64 # static Linux programs under qemu-aarch64 in WSL
python tools/package.py Kritzel --arch aarch64                 # Kritzel_Setup_arm64.exe, kritzel_0.1.0_arm64.deb

The ARM64 programs are built on the x86-64 PC like the others; the x86-64 programs and packages do not change. Each package format has an ARM64 file of its own (setup, MSIX, .deb, RPM, AppImage, Flatpak; packaging guide "ARM64"), and one update channel lists both processors. Plugins and modules are built per processor; one of the other processor is refused with a message. How it is tested -- GitHub's windows-11-arm and ubuntu-24.04-arm runners, an ARM64 VM with 4 and 64 KB pages, the memory model also on an Apple M2 and an Android phone -- and what is not tested yet (a Windows on ARM device with its own display, an ARM64 Linux device with a GPU: Vulkan on ARM64 only with lavapipe) is in the ARM64 plan. Numbers read from and written as text are the same bits as on x86-64; exp2, log2, pow, sin, cos and atan2 are not bit for bit those of x86-64's x87 (mostly the same bits, otherwise usually 1 ulp apart; measured in the plan, ARM2).

Browser builds#

rustup target add wasm32-unknown-unknown
rustup component add rust-src
python build_rs.py app gallery --target web
python tools/serve_web.py build/web/gallery

Then open http://127.0.0.1:8766/. LLVM's wasm-ld is also required. The default build includes scalar, SIMD128, and worker variants; the browser host selects a variant based on available capabilities. The local server supplies the isolation headers required for shared memory.

Use --web-mode scalar to build only the scalar variant, which does not require rust-src. Other apps follow the same pattern, for example python build_rs.py app jfWord --target web. See the web and agent infrastructure guide and WASM compute documentation.

Android APKs#

Additional requirements are JDK 17+, Android SDK Platform 36, Build-Tools 35+, and NDK r29. ANDROID_SDK_ROOT / ANDROID_HOME and ANDROID_NDK_HOME can override the automatically detected paths.

rustup target add aarch64-linux-android
python build_rs.py app androidGallery --target android

Output: build/android/androidGallery-arm64-v8a-debug.apk. For an x86-64 emulator:

rustup target add x86_64-linux-android
python build_rs.py app androidGallery --target android --android-abi x86_64

Android builds use Cargo, the SDK, and the NDK, without Gradle. Debug builds are signed with a local debug key. --release signs with the release key named by jfgui_ANDROID_KEYSTORE, jfgui_ANDROID_KEYSTORE_PASS, and jfgui_ANDROID_KEY_ALIAS (jfgui_ANDROID_KEY_PASS if the key has its own password) and writes <app>-<abi>-release.apk; without them the build stops and names what is missing (jfgui_ANDROID_DEBUG_SIGN=1 keeps the debug key for test builds; docs/PACKAGING.md, "Signing"). Only builds under the debug key are debuggable (the self-tests' jfgui_* extras); a manifest that sets android:debuggable stops a release build. python tools/android_ci.py runs the tests without a UI on an emulator of its own (an AVD from the local system-images;android-35;default;x86_64, nothing downloaded): coretest, plattest, asynctest and jfWord's self-test per adb shell and in an app's process, as the workflow android.yml does on GitHub. Other apps need an Android entry in TARGETS and a suitable manifest and resources.

An app of your own builds for the browser (cargo jflib web), Android (cargo jflib android) and iOS (cargo build --target aarch64-apple-ios on a Mac), and cargo jflib package makes its installers and packages (Your own app with Cargo, the README of cargo-jflib, the packaging guide). This repository's own apps get their browser, Android and iOS builds, their style variants and packages from the repository's tool build_rs.py, as its tests do (developer guide, section 2; web and agent guide; docs/APPLE.md).

Pocket Gallery desktop preview with buttons, a checkbox, a switch, a slider, accent colors, and text input

Build Manager#

The Build Manager is itself a JFLIB app. It provides a graphical workspace for the existing Python build tools: select apps and styles, save profiles, prepare jobs, track builds, run tests, and launch completed apps. Python, Rust, and LLVM are still required when using the Build Manager.

Build Manager with app selection, platforms, styles, a build profile, and results

Build and launch it once:

cd apps/buildManager
cargo run

The current app uses German UI labels. The steps below include those labels so you can find the corresponding controls:

  1. Open Project & Tools (Projekt & Werkzeuge) and select the JFLIB directory or its build_rs.py if automatic detection fails. Check the Python path and, on Windows, the WSL distribution if needed.
  2. Select apps on the left. Under Development (Entwicklung), choose target platforms, optional styles, compiler processes, and app tests. Save the selection as a profile if desired.
  3. Choose Prepare jobs (Aufträge vorbereiten), review the displayed commands, and add the jobs to the queue.
  4. Under Jobs & Results (Aufträge & Ergebnisse), inspect logs, tests, and build outputs. Use Launch (Starten) to create launch profiles with a theme, scale, and additional arguments.
  5. Use Release to prepare optimized builds and packages. Package data (Paketdaten) contains the metadata from apps/APP/PACKAGE.

The GUI currently offers Windows, Linux, and Web build targets, not yet Android. Release packages need suitable package metadata and resources. Windows installers require a Windows host; Debian packages require dpkg-deb (through WSL on Windows). Output defaults to build/manager/, and profiles are saved in build-profiles.json.

See the Build Manager documentation and packaging guide for details.

Small GUI examples#

A window with a click counter#

Make a project with cargo jflib new hello and replace its src/lib.rs with this complete app (its src/main.rs only links it):

#![no_std]
#![deny(unsafe_code)]

extern crate alloc;
use jflib::{style, ui};
use ui::*;

const DESC: AppDesc = AppDesc {
    title: "Hello JFLIB",
    flags: AF_RESIZABLE,
    w: 480,
    h: 300,
    min_w: 320,
    min_h: 240,
    ..AppDesc::NONE
};

#[derive(Default)]
struct Counter {
    clicks: u32,
}

impl App for Counter {
    fn frame(&mut self, ui: &mut Ui) {
        ui.box_begin(0, BOX_V | pad(24), 12);
        ui.text(TS_TITLE, "Hello JFLIB!");
        ui.text(TS_BODY, &alloc::format!("Clicks: {}", self.clicks));
        if ui.accent_button(100, "Click me") & EV_ACT != 0 {
            self.clicks += 1;
        }
        if ui.button(101, "Reset") & EV_ACT != 0 {
            self.clicks = 0;
        }
        ui.box_end();
    }
}

ui::main!(ui::launch(&DESC, Counter::default(), &style::STYLE));
cd hello
cargo run

The click counter example after two clicks, with German labels in this screenshot

AppDesc describes the window, Counter holds the state, and frame describes the widgets. Buttons report activation through EV_ACT. Sizes and spacing are expressed in device-independent pixels (DIP); the library handles scaling. style::STYLE refers to the style selected at build time.

A text field, checkbox, and slider#

In the example above, replace Counter, its impl App, and the ui::main! invocation with this version. Keep the crate attributes, extern crate alloc, the use lines, and DESC unchanged:

#[derive(Default)]
struct Form {
    name: alloc::string::String,
    enabled: i32,
    value: i32,
}

impl App for Form {
    fn frame(&mut self, ui: &mut Ui) {
        ui.box_begin(0, BOX_V | PAD_16, 12);
        ui.text(TS_SUBTITLE, "Settings");
        ui.textbox(200, Some("Your name"), &mut self.name, 128);
        ui.checkbox(201, "Enable option", &mut self.enabled);
        ui.slider(202, &mut self.value, &Range::new(0, 100, 1, 0));
        ui.progress(203, self.value, 100);
        ui.text(TS_BODY, &alloc::format!("Value: {} %", self.value));
        ui.box_end();
    }
}

ui::main!(ui::launch(&DESC, Form::default(), &style::STYLE));

The form example with text input, a checkbox, a slider, and a progress bar, shown with German labels

Values are updated directly through &mut. Checkboxes use i32 (0 / 1), and widget IDs must be unique within a frame. File operations, dialogs, and larger actions can be dispatched to App::command through ui.cmd_run(...).

In this repository an app's program is src/main.rs or a flat main.rs, never both; a STYLE file (such as kde) and a TARGETS file (such as win linux web) tell build_rs.py the app's default style and its targets. More examples: template, widget gallery, and developer guide.

Styles#

The style is selected at build time. Light/dark themes, accent colors, and scaling can change at runtime. The style and operating system are independent of each other. Apps can lay their own theme over any style at runtime -- colors, corner radii, spacing, control heights, and type from a small INI file, no style crate needed -- and an app that links several styles can switch between them while it runs (App themes, apps/themedemo).

StyleAppearance
winuiModern Windows/Fluent interface with rounded controls
classicClassic gray interface with raised and sunken borders
macosControls and window decorations inspired by macOS
kdeInterface inspired by KDE Plasma/Breeze
jfofficeOffice style with its own typography, ribbon components, and blue accents
backupcraftWinUI layers with KDE Breeze framing, petrol accent, compact controls, own icons

The same widget gallery with six styles and two themes:

WinUI · lightClassic · light
Widget gallery in the light WinUI styleWidget gallery in the Classic style
macOS style · lightKDE style · light
Widget gallery in the macOS style on WindowsWidget gallery in the KDE style on Windows
jfOffice · lightWinUI · dark
Widget gallery in the jfOffice styleWidget gallery in the dark WinUI style
BackupCraft · light
Widget gallery in the BackupCraft style
JFLIB_STYLE=kde cargo run     # an app of your own: jflib::style is then the KDE style

JFLIB_STYLE names winui (the default), classic, macos, kde or netlab; every style is also there under its own name (jflib::style_kde::STYLE) for a switch at run time. The apps of this repository name their style in their Cargo.toml.

The apps use the same styles. Here is Kritzel with Classic:

Kritzel displaying the same JFLIB drawing in the Classic style

cd apps/gallery
cargo run -- --theme dark --scale 150

STYLES.md describes the style contract, creating custom styles, and the origins of bundled font and icon assets. See jfOffice for more details about the Office style.

Screenshots and checks#

GUI apps can render directly to a PNG without opening a visible window:

cd apps/gallery
cargo run -- --shot gallery.png --size 1000x800 --scale 100 --theme light --anim off

--shot saves the image and exits the app. To prepare particular views or interaction sequences, use .uis scripts with commands such as click, type, theme, expect, and shot. Run the existing template test with:

cd apps/template
cargo run -- --script tests/smoke.uis --verify-dirty

The repository's own checks and its test suite run from its root:

python build_rs.py check
python build_rs.py test --quick --target win

check validates the source-code rules and then runs Clippy over the library (its groups correctness and suspicious; check --quick: the rules alone). test --quick starts the broader test suite and skips the historical assembly parity checks; test NAME builds one app and runs only its scripts. python build_rs.py api-diff lists the changes of the public API since the last release (versions). The full parity run also requires the separate assembly reference. rust-analyzer reads the Cargo workspace in the root Cargo.toml directly.

Documentation#

GuideContents
Developer guideApp model, layout, widgets, menus, dialogs, files, and scripted tests
API referenceLibrary functions and types
StylesAppearance, style interfaces, and assets
Build ManagerProfiles, queue, tests, launching, and releases
PackagingWindows installers, Debian packages, AppImage, Flatpak, MSIX, RPM, icons, and package metadata
Virtual files and assetsapp://, config://, data://, cache://, mem://, mounts, and bundling apps/NAME/assets
PermissionsThe PERMISSIONS manifest: files, programs, URLs, plugins, printing, secrets, autostart, sound, global shortcuts, pictures of the screen, and network addresses an app may use
SecretsPasswords, tokens, and keys in the system's secret store (Credential Manager, Secret Service)
Third-party noticesPorted third-party code, Unicode data, fonts, and artwork with their copyright holders and licenses (texts in licenses/)
VersionsThe library's version, the public API and its SemVer rules, deprecations, build_rs.py api-diff and releases
ChangelogWhat changed in each release of the library
RoadmapWhat the library still lacks, with priorities (German)
Linux test planWhat is checked on real Linux desktops and what is still to check on KDE, GNOME and X11 (German)
ARM64 planThe port to ARM64 on Windows and Linux: milestones, results, traps, how it is tested (German)
Intel Mac planJFLib on Macs with an Intel processor: one program for both, what is tested and what is open (German)
Apple planThe native macOS and iOS versions: windows, menus, Metal, VoiceOver, the iPad (German)
Android planBringing Android up to Windows, Linux and Apple: threads, network, file system, printing, system fonts; milestones, traps, tests (German)
Game engine planA game engine on render3d: decisions, crates, stages G7a to G7p from a first multiplayer game to procedural cities, tests (German)
PhysicsCollision for games: shapes, broad phase, rays, swept shapes, contacts; f64, the same bits on every target; tests and measurements (German)
Game coreThe game engine's core: entities and components, a fixed tick with interpolation, input actions bound to key positions with the pointer lock, cameras, the bridge to render3d; tests (German)
ModellingModels described in JFScript: lib/geom (meshes from primitives, profiles and operations, checks), apps/modeltool (pictures, report, glTF), what JFScript needs (German)
TransportThe network of games: WebSocket in netio, the browser's WebSocket, lib/netchan's channel over UDP and WebSocket; wire format, limits, tests, measurements (German)
NetcodeMultiplayer in lib/game: a server-authoritative tick, prediction and reconciliation, delta snapshots under 1200 bytes, lag compensation, rooms, bots; tests and measurements with 16 bots (German)
Game 1The first game on the engine (working name game1): a cartoon multiplayer shooter for the browser and the desktop; crates, map from JFScript, rules, tests, checksums, measurements (German)
Android GalleryAPKs, Android prerequisites, input, and port status
Web and agent controlBrowser host and explicit CLI/JSON/MCP interfaces
jfWordDocument editing and current feature coverage
BackupJFServer, agents, console and bcctl: setup, architecture, security model, tests

Some older documents still refer to a RustLib/ directory. In this standalone repository, that corresponds to the repository root.

DirectoryContents
lib/ui, lib/gfx, lib/textWidgets, runtime, layout, graphics, and text rendering
lib/rt, lib/simd, lib/plat, lib/baseRuntime, compute kernels, platform integration, and base types
lib/img_*, lib/fxImage formats, image processing, and effects
lib/doc_*, lib/archiveDocument model, layout, rendering, and file formats
lib/pdf, lib/sheet_io, lib/dxf, lib/formatsPDF; Excel and CSV; DXF; JSON, XML and text encodings
lib/diagram_core, lib/diagram_io, lib/diagram_viewDiagrams of the Visio kind: the model, the files, the drawing
lib/gpu, lib/wgsl, lib/shader, lib/render2d, lib/render3d, lib/gltfThe GPU layer, shaders, the 2D renderer for CAD, the 3D engine, glTF
lib/game, lib/game_render3d, lib/physics, lib/geom, lib/netchanBuilding blocks for games
lib/agent_core, lib/agent_ioContracts and transports for optional app control
lib/crypto, lib/compress, lib/datetimeCryptography, LZ4, time zones and cron schedules
lib/netio, lib/x509, lib/datastore, lib/casHTTP, TLS, SSH, DNS; X.509 certificates; the journal database; backup repositories
styles/The seven bundled styles
apps/Applications, examples, and their tests
plugins/, modules/Native extensions and loadable modules
web/, android/Browser host and shared Android adapter
tools/Build helpers, packaging, tests, and documentation tools
docs/References, guides, and the screenshots used in this README
build/Generated programs, library components, and test output

The documentation as a website#

python build_rs.py site            # -> build/site/index.html
python build_rs.py site --check    # build into a temporary folder and check links, anchors, images

site (tools/site.py, Python standard library only) turns this README, the guides listed above, the changelog, the roadmap and the API reference into the docs of the JFLib website: a start page, one page per section of the developer guide and per crate of the API reference, a search over titles, headings and API items, and the website's look in light and dark. The test suite runs the check. The website's repository holds its start page, features and apps, and its build puts these docs into its folder docs/, from the JFLib commit in its jflib.lock. Top bar and footer link to the website one folder up, where the fonts are as well; built on its own the docs use the system's fonts, and those links lead nowhere.

License#

JFLib is dual-licensed under the MIT License or the Apache License 2.0, at your option. The apps Kritzel and BackupCraft are released under the MIT License (their license.txt). Third-party code, data and fonts keep their own licences; see THIRD_PARTY_NOTICES.md and styles/NOTICE.md.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in JFLib by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.

Trademarks#

Microsoft, Word, and Office are trademarks of Microsoft Corporation. Cisco, IOS, and Packet Tracer are trademarks of Cisco Systems, Inc. These names appear only to describe file formats, command-line conventions, and comparable products. JFLib and its apps are independent projects and are not affiliated with, sponsored, or endorsed by Microsoft or Cisco. Other product names may be trademarks of their respective owners.

Source: README.md in the JFLib repository.