RmlUi

Native C++ XS bindings for the RmlUi user interface library.

RmlUi 0.01 provides native desktop and headless UI support. The bindings provide contexts, documents, DOM lookup and mutation, and borrowed-object lifetime checks. The headless runtime does not require a display or event loop. Perl event listeners, copied event snapshots, and safe callback exception propagation are included. Font loading, explicit input processing and layout inspection are available. DOM construction and event propagation controls are available. Application-defined rendering backends are supported through the basic and advanced renderer contract; see RmlUi::Renderer. Optional host system services are supported; see RmlUi::System. A bundled SDL3/OpenGL backend provides native window creation and presentation.

Build and test

Install Alien::RmlUi 0.02 (and its Alien::FreeType dependency) and Alien::SDL3::Native 0.01, then run:

perl Makefile.PL
make
make test

A C++17 compiler is required. The initial release has been tested on Linux, including a clean distribution build, installation and native window rendering. Windows and macOS have not yet been verified. Native windows require a working SDL3 video backend and OpenGL 3.3 support; headless tests do not require a display. Set CXX to select a compatible compiler. See the RmlUi POD for the API and current limitations.

Binding and backend code: MIT license. Bundled fonts: SIL Open Font License 1.1 (see lib/RmlUi/fonts/LICENSE.txt).

Native desktop window (experimental)

The bundled SDL3/OpenGL 3.3 backend uses Alien::SDL3::Native and upstream RmlUi 6.3 renderer and platform sources (see LICENSE.RmlUi-backends). Run perl -Mblib examples/window.pl after building. Native windows load the bundled OFL-licensed LatoLatin fonts by default; custom fonts are still supported (examples/window.pl /path/to/font.ttf 'Font Family'), and open_window(default_font => 0) disables the bundled fonts. Run RMLUI_TEST_WINDOW=1 make test on a graphical desktop for the native smoke test. One window/context. Supports generated textures, fonts, PNG, JPEG, BMP, TGA and GIF (first frame) assets. The private stb_image decoder is included under MIT (see third_party/README.md); use trusted application assets. Files are limited to 64 MiB, each axis to 8192 pixels, and total image size to 32 Mi pixels. initialize() remains headless or accepts custom interfaces; open_window() selects the bundled backend. Call from the main application thread.

Include a <head> element in RML documents that reference relative assets; RmlUi 6.3 records the document source URL while parsing the head.

Desktop applications

use RmlUi::Application;
my $app = RmlUi::Application->new(title => 'Hello');
my $doc = $app->load_document_from_string('<rml><body>Hello from Perl!</body></rml>');
$doc->show;
$app->run;

run renders, waits for input, and closes the runtime when the window closes or $app->quit is called. quit is safe inside event listeners. Use $app->close if abandoning an application before run. The underlying context remains accessible through $app->context. Try perl -Mblib examples/application.pl.

Release verification (Unix)

From the repository root, run RMLUI_TEST_WINDOW=1 sh tools/test-dist.sh on a graphical desktop. Omit RMLUI_TEST_WINDOW for a headless test. The script generates the CPAN tarball, builds and tests it in a temporary directory, installs it into a temporary prefix, and loads the installed modules and fonts outside the source tree. It does not install RmlUi globally or upload anything. The tarball remains in the repository root for release.