ferroui-linuxframebuffer 0.1.0-preview.1

Reserved name: the Linux framebuffer platform of FerroUI, which is not ported yet. This version is an empty placeholder
Documentation

FerroUI

CI License: MIT

FerroUI is a cross-platform UI framework for Rust: a retained-mode control library with a styled property system, data binding, XAML markup, control themes and a composition-based renderer. It is a port of the Avalonia UI framework to idiomatic, safe Rust that keeps the original architecture, contracts and behaviour, so that applications, themes and markup written against that model carry over with their structure intact.

Status: preview. The framework builds and runs on macOS, Windows, Linux (X11), iOS, Android and in the browser, paints themed controls and passes a large ported test suite. The public API is not stable and several subsystems are incomplete; macOS and the browser are the most complete platforms, the others are newer and less tested. See Project status.

Fluent theme rendered by FerroUI

Highlights

  • Complete object model. Styled and direct properties with value priorities, inheritance, coercion and change notification; logical and visual trees; routed events; layout; input, focus and gestures.
  • Styling and theming. Selectors, styles, control themes, resources, theme variants and transitions. The Fluent and Simple themes are included.
  • Data binding. Compiled and reflection-style binding paths, converters, multi-bindings, data validation and templates.
  • XAML. A port of the XamlX compiler front end together with the framework's transformers and markup extensions. Documents are compiled to Rust source by the build script of a crate, or loaded at run time.
  • Composition renderer. A compositor with a render loop, dirty-region tracking and server-side visuals, drawing through a backend-neutral drawing context.
  • Swappable backends. Rendering and windowing sit behind contracts. The backends are Skia (Graphite on Metal, Ganesh on OpenGL, ANGLE and WebGL, raster) for rendering, with an experimental Vello backend, HarfBuzz for text shaping, and platform backends for macOS, Windows, Linux (X11), iOS, Android and the browser.
  • Safe Rust. The controls, markup, XAML and theme crates contain no unsafe code. It is confined to a small part of the object model core and to the rendering, text shaping, platform and interop backends.

Project status

Area State
Property system, trees, layout, input, styling, resources Ported
Data binding, animation, transitions Ported
Media, text layout, fonts Ported
Compositor and render loop Working; composition animations and custom visuals outstanding
Skia and HarfBuzz backends Working
macOS platform Windows, input, clipboard, drag and drop, menus, tray icon; storage dialogs and parts of accessibility outstanding
Controls Most of the control set, including items controls, text input, menus, pickers, calendar, pages and automation peers
XAML Compilation of markup to Rust source at build time (used by the themes and the samples), and the run-time loader with the upstream test suites
Themes Fluent and Simple load for every ported control
Windows platform Windows, input, clipboard and drag and drop over OLE, file dialogs, tray icon, native control host, extended client area; rendering in software, through ANGLE and through DirectComposition. Input methods (IME), UI Automation, WGL and the blur effects of composition outstanding
Linux platform (X11) Windows, input, input methods (XIM, IBus, Fcitx), clipboard, drag and drop, the desktop portals, GTK file dialogs, menus and tray icon over D-Bus, session management, native control host, accessibility over AT-SPI; rendering in software, through GLX and EGL. Wayland, the Linux framebuffer and Vulkan outstanding
iOS platform A view over Metal, touch, keyboard and text input, clipboard, storage, native control host, accessibility. Verified in the simulator only
Android platform A view over a surface with EGL or software rendering, touch, keyboard and text input, lifecycle, clipboard, storage, native control host, accessibility. Verified on the emulator only; the native library is built with a nightly toolchain for now (docs/porting/android-platform.md, section 5.1)
Browser (WebAssembly) Working; in progress
Vello render backend Experimental: CPU, hybrid and GPU modes, measured against the Skia backend, which is the default and the reference; the open work is listed in docs/porting/vello-backend.md, section 13

About 95 percent of the members of the upstream projects that are in scope have a counterpart, and about three quarters of the members of every upstream project (the projects that are not ported yet, such as Wayland and Vulkan, count in the second number). The per-subsystem state is tracked in docs/porting/CRITICAL-PATH.md and the per-member state in docs/porting/TRACKING.md.

Requirements

  • Rust 1.89 or later
  • One of the platforms:
    • macOS 11 or later with the Xcode command line tools
    • Windows (x64 or ARM64; verified on Windows 11 and on the Windows Server runners of the continuous integration) with the MSVC build tools; rendering through ANGLE needs libclang
    • Linux with X11 and the development packages of fontconfig
    • iOS (Xcode), Android (the SDK and NDK, and a nightly toolchain for the native library) and the browser (Emscripten): see the platform documents under docs/porting
  • Python 3 for the maintenance scripts (not needed to build)

The first build compiles or downloads Skia and can take a while.

Installation

Upcoming. The crates are not on crates.io yet. The first preview, 0.1.0-preview.1, is being prepared; until it is published the dependency lines below do not resolve and the badges of the table read "not found". Build from the repository instead (Getting started).

FerroUI is a set of crates that are released together at one version. A desktop application names the base library, the controls, the desktop entry point and a theme:

[dependencies]
ferroui-base = "=0.1.0-preview.1"
ferroui-controls = "=0.1.0-preview.1"
ferroui-desktop = "=0.1.0-preview.1"
ferroui-themes-fluent = "=0.1.0-preview.1"

A preview is a pre-release in the sense of semantic versioning (0.1.0-preview.1, 0.1.0-preview.2, ... before 0.1.0). Cargo selects a pre-release only when it is named, and the crates of one preview depend on one another at exactly that version, so name the same version for every FerroUI crate, as above. A preview may change any part of the public API. The release process is described in docs/release.md and the changes of each release in CHANGELOG.md.

Markup is loaded at run time with ferroui-markup-xaml-loader, or compiled by the build script of the application with ferroui-build (a build dependency) against ferroui-markup-xaml.

Crates

Core

Crate Description Version Downloads Documentation
ferroui Reserved name: the facade crate of FerroUI, which does not exist yet. This version is an empty placeholder version downloads docs.rs
ferroui-base The base library of FerroUI: the property system, layout, input, styling, media, text, animation, data binding and the compositor version downloads docs.rs

Controls and themes

Crate Description Version Downloads Documentation
ferroui-controls The controls of FerroUI: the application model, top levels, the control set and automation peers version downloads docs.rs
ferroui-fonts-inter The Inter font family as an embedded font collection of FerroUI version downloads docs.rs
ferroui-dialogs The managed dialogs of FerroUI: the managed file chooser, the managed storage provider and the about dialog version downloads docs.rs
ferroui-themes-fluent The FerroUI Fluent theme: control themes, colour palettes and resources for the control set, in light and dark variants version downloads docs.rs
ferroui-themes-simple The FerroUI Simple theme: control themes and resources for the control set, in light and dark variants version downloads docs.rs
ferroui-controls-color-picker The colour picker library of FerroUI: ColorPicker, ColorView, ColorSpectrum, ColorSlider, ColorPreviewer, the colour palettes and their control themes version downloads docs.rs

Markup and build

Crate Description Version Downloads Documentation
ferroui-build-scan The build-time type model of FerroUI and the source scanner that fills it: what a build script exports of a crate, linking nothing of the framework version downloads docs.rs
ferroui-markup The markup support of FerroUI: binding path parsing and reflection-style bindings version downloads docs.rs
ferroui-markup-xaml The FerroUI XAML runtime library: markup extensions, templates, includes, converters and the runtime helpers of compiled XAML version downloads docs.rs
xamlx Rust port of the backend-independent part of XamlX (XAML compiler library) version downloads docs.rs
ferroui-markup-xaml-loader The FerroUI XAML language definition and compiler extensions built on xamlx version downloads docs.rs
ferroui-build Build-script support of FerroUI: compiles the markup documents of a crate to Rust source and embeds its assets version downloads docs.rs

Render backends and text

Crate Description Version Downloads Documentation
ferroui-metal The Metal platform contracts of FerroUI: the device, the surface of a top-level and the import of external objects version downloads docs.rs
ferroui-harfbuzz The HarfBuzz text shaping backend of FerroUI version downloads docs.rs
ferroui-opengl The OpenGL platform contracts of FerroUI: contexts, surfaces and the entry points the framework itself uses version downloads docs.rs
ferroui-skia The Skia render backend of FerroUI: Graphite on Metal, Ganesh on WebGL and raster version downloads docs.rs
ferroui-vulkan Reserved name: the Vulkan platform contracts of FerroUI, which is not ported yet. This version is an empty placeholder version downloads docs.rs
ferroui-vello The Vello render backend: the render contracts of the base library on kurbo, peniko and the renderers of the Vello project version downloads docs.rs

Platforms

Crate Description Version Downloads Documentation
ferroui-headless-vnc Reserved name: the VNC server of the headless platform of FerroUI, which is not ported yet. This version is an empty placeholder version downloads docs.rs
ferroui-linuxframebuffer Reserved name: the Linux framebuffer platform of FerroUI, which is not ported yet. This version is an empty placeholder version downloads docs.rs
ferroui-microcom The COM-style interop runtime of FerroUI, which its native platform backend is built on version downloads docs.rs
ferroui-freedesktop The FreeDesktop services of FerroUI for Linux desktops: D-Bus input methods, portals, menus, tray icons and accessibility over AT-SPI version downloads docs.rs
ferroui-android The Android platform of FerroUI: a view in an activity, rendered through EGL or to the native window version downloads docs.rs
ferroui-wayland Reserved name: the Wayland platform of FerroUI, which is not ported yet. This version is an empty placeholder version downloads docs.rs
ferroui-winui Reserved name: the WinUI integration of FerroUI, which is not ported yet. This version is an empty placeholder version downloads docs.rs
ferroui-native The macOS platform of FerroUI: windows, input, clipboard, drag and drop, menus and Metal graphics over a native library version downloads docs.rs
ferroui-headless The headless platform of FerroUI: windows without a screen, driven by simulated input, for tests version downloads docs.rs
ferroui-ios The iOS platform of FerroUI: a UIKit view, touch input and Metal graphics version downloads docs.rs
ferroui-browser The browser platform of FerroUI: a top-level in an element of a web page, rendered with WebGL or to a 2D canvas version downloads docs.rs
ferroui-win32 The Windows platform backend: windows, the message loop, input, screens and the software surface over the Win32 API version downloads docs.rs
ferroui-x11 The X11 windowing platform of FerroUI for Linux version downloads docs.rs
ferroui-desktop The desktop entry point of FerroUI: platform detection with the default render and text shaping backends version downloads docs.rs

Tools and designer support

Crate Description Version Downloads Documentation
ferroui-remote-protocol The remote protocol of FerroUI: the messages of the previewer and of remote rendering, their BSON serialization and the transports that carry them version downloads docs.rs
microcom-codegen Code generator of the FerroUI interop runtime: a C++ header and Rust bindings from an interface definition file version downloads docs.rs
ferroui-designer-support Designer support of FerroUI: the loader of the previewed window and the previewer that talks to an IDE over the remote protocol version downloads docs.rs

Getting started

Clone the repository and build the workspace:

git clone https://github.com/wieslawsoltes/FerroUI.git
cd FerroUI
cargo build --workspace

Run the examples:

# A window with a few controls built in code
cargo run -p ferroui-desktop --example hello_window

# Themed controls, Simple theme (add -- --fluent for the Fluent theme)
cargo run -p ferroui-themes-simple --example themed_window

# The ControlCatalog sample application
cargo run -p control-catalog-desktop

Run the tests:

cargo test --workspace

A minimal application

An application is a class derived from Application that creates its main window when the framework has finished initialising. The window content can be built in code:

fn create_main_window() -> Ref<Window> {
    let text = TextBlock::new();
    text.set_text(Some("Hello from FerroUI"));
    text.set_font_size(24.0);

    let button = Button::new();
    button.set_content(Some(Rc::new("Click me".to_string())));
    button.click(|_, _| println!("Button clicked"));

    let panel = StackPanel::new();
    panel.set_spacing(12.0);
    panel.children().add(text);
    panel.children().add(button);

    let window = Window::new();
    window.set_title(Some("Hello".to_string()));
    window.set_content(Some(Control::boxed(panel)));
    window
}

fn main() -> std::process::ExitCode {
    let args: Vec<String> = std::env::args().skip(1).collect();
    let exit_code = AppBuilder::configure::<App>()
        .use_platform_detect()
        .start_with_classic_desktop_lifetime(&args);
    std::process::ExitCode::from(exit_code as u8)
}

The complete program, including the App class declaration, is hello_window.rs. The API is still changing; that example is kept building and is the authoritative reference.

Markup

Views can be written in XAML. FerroUI uses its own XML namespace:

<Window xmlns="https://github.com/ferroui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Hello">
  <StackPanel Margin="16" Spacing="8">
    <TextBlock Text="{Binding Greeting}" />
    <Button Content="Click" Command="{Binding ClickCommand}" />
  </StackPanel>
</Window>

Repository layout

The layout follows the upstream project so that files can be compared side by side.

Path Crate Contents
src/FerroUI.Base ferroui-base Object model, layout, input, styling, media, text, animation, binding core, compositor
src/FerroUI.Controls ferroui-controls Application model, top levels, the control set, automation peers
src/Markup/FerroUI.Markup ferroui-markup Binding path parsing and reflection-style bindings
src/Markup/FerroUI.Markup.Xaml ferroui-markup-xaml XAML run-time library and markup extensions
src/Markup/FerroUI.Markup.Xaml.Loader ferroui-markup-xaml-loader Compiler extensions and the run-time loader
external/XamlX xamlx XAML compiler front end
src/Skia/FerroUI.Skia ferroui-skia Skia render backend
src/HarfBuzz/FerroUI.HarfBuzz ferroui-harfbuzz HarfBuzz text shaping backend
src/FerroUI.OpenGL ferroui-opengl OpenGL contracts used by the GL render path
src/FerroUI.Fonts.Inter ferroui-fonts-inter Embedded Inter font collection
src/FerroUI.Native, native/FerroUI.Native ferroui-native macOS platform backend and its native library
src/FerroUI.MicroCom ferroui-microcom COM-style interop runtime used by the native backend
src/FerroUI.Desktop ferroui-desktop Desktop entry point and platform detection
src/Browser/FerroUI.Browser ferroui-browser Browser platform backend (WebAssembly) and its script module
src/FerroUI.Themes.Fluent, src/FerroUI.Themes.Simple ferroui-themes-fluent, ferroui-themes-simple Themes
samples control-catalog, control-catalog-desktop, mini-mvvm Sample applications
tests Ported XAML test suites
docs/porting Porting guide, design notes and tracking documents
scripts Code generators, upstream synchronisation and status tooling

Documentation

Contributing

The project is in an early phase and its structure is still moving, so please open an issue to discuss a change before sending a pull request. Contributions are expected to follow the porting guide: port files one to one with their tests, keep behaviour identical to the reference implementation, and keep cargo test --workspace green.

License

FerroUI is licensed under the MIT License.

It is derived from other open source projects, and some files are carried under their original licenses. See NOTICE.md and the component-level notices it refers to for the full attributions and license texts.