Skip to content
Richard7987Public

About

Watercolour flora and gilt ornaments grown in the margins of Typst documents

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hortulus

Typst Universe Package version Typst version Latest release License: MIT Plugin: Rust to WebAssembly

Watercolour flora and gilt ornaments grown in the margins of Typst documents. Every page grows its own plant around the text it holds, computed when the document compiles and painted as vector paths. No tool is needed beyond Typst.

Full documentation · Typst Universe · Releases

Four pages: a right margin, a crowned title page, a wreath around the text, and flora in both margins

Quick start

#import "@preview/hortulus:0.1.0": flora

#set page(margin: (left: 2.5cm, right: 5.5cm, y: 2.5cm))
#show: flora.with(layout: "right", colourway: "spring", seed: 7)

= My document
#lorem(200)

Give the flora room: about 5 cm for a side margin, or 3 cm all round for surround. Every option is described in the documentation. Pass draft: true to leave the flora out while you write.

Changes

0.1.1 (in this repository, not yet on Typst Universe)

  • PDFs about 45% smaller, and each page embeds faster: coordinates are written to a tenth of a point, and the smallest dots as squares or octagons of the same area, all within 0.03 mm of the previous drawing.
  • A page whose spec has not changed is no longer grown again after an edit elsewhere in the document.

0.1.0: first release.

Gallery

Up close: the blooms are vector paths painted like watercolour, and the gold is computed per pixel.

Close-up of a title page: two blue blooms on either side of a gilt laurel crest

The eight colourways: spring, summer, autumn and winter above; ember, plum, rose and original below.

Eight pages with the same layout, one in each colourway

The same page with other options. Above: density: 0.4, density: 2, visitors: 4 and mix: (lily: 3, bloom: 0, umbel: 0). Below: palette with one ink, palette with two inks, ornaments: (moon: 5, night: 0, sun: 0, planet: 0) and draft: true.

Eight pages showing density, visitors, mix, palette, ornaments and draft

The plant grows around what the page holds: a gap in the text, a table and an equation, a floating figure, and two columns with layout: "split".

Four pages where the flora fills a gap, surrounds a table and an equation, stops at a floating figure, and follows two columns

Repository

  • package/: the Typst package, as published.
  • plugin/: the Rust source of the package's WebAssembly plugin.
  • reference/: the Lua generator of tikz-flora (MIT), which the plugin ports and is checked against.
  • tools/: the build scripts and the tests.

Building the plugin

You need a Rust toolchain with the wasm32-unknown-unknown target, and wasm-opt from Binaryen.

RUSTUP_HOME=... CARGO_HOME=... tools/build_wasm.sh   # see the script for the paths it sets
cp build/hortulus.wasm package/hortulus.wasm

Rebuilding the images

With typst and ImageMagick on your path, tools/build_gallery.sh paints the gallery from tools/gallery/ into package/images/.

Checking against the reference

With texlua on your path and the native build in place (cargo build --release in plugin/), tools/run_matrix.sh paints each case with both generators and compares the output byte for byte. The package itself writes a more compact encoding of the same drawing; pass compact as a fourth argument to native to get it.

License

MIT. See LICENSE. reference/ keeps its own license.

About

Watercolour flora and gilt ornaments grown in the margins of Typst documents

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages