Skip to content

Add glu typesetter with samples for all eleven demos - #23

Merged
alerque merged 16 commits into
alerque:masterfrom
pgundlach:feature/glu
Aug 25, 2026
Merged

Add glu typesetter with samples for all eleven demos#23
alerque merged 16 commits into
alerque:masterfrom
pgundlach:feature/glu

Conversation

@pgundlach

Copy link
Copy Markdown
Contributor

This adds glu as a typesetter. glu renders
Markdown, HTML or Lua straight to PDF on top of the boxes and glue
typesetting library (OpenType shaping, Knuth-Plass line breaking, an
OpenType-MATH engine and CSS Paged Media support).

Included:

  • Makefile pattern rules for glu.md / glu.html / glu.lua inputs,
    mirroring the SILE multi-extension setup, plus a .fonts download
    target for the Libertinus faces the samples reference.
  • A buildGoModule package for glu in the Nix dev shell (glu is not
    in nixpkgs yet); unzip joins the shell inputs for the font target.
  • Samples for all eleven demos. Some highlights: title-case implements
    the casing rules (including Turkish i/İ) in an embedded Lua block,
    hieroglyphs exercises the engine's USE shaping of the Egyptian
    quadrat composition, and Willans' formula runs through stretchy
    fences built from glyph variants and assemblies. Where the engine
    has a known gap (the overline form of varlimsup) the sample says so
    in a source comment instead of faking the output.

All eleven glu samples (PDFs and AVIF previews) render in a pure Nix
environment (nix develop --ignore-environment).

@alerque

alerque commented Aug 20, 2026

Copy link
Copy Markdown
Owner

This is fantastic, thanks for taking the time to put this together! I'm traveling right now (and currently on 1 bar of 2G cell data!) so it might take me until next week to review it properly, but from the sounds of things I expect to be able to make this work and get it online.

@pgundlach

Copy link
Copy Markdown
Contributor Author

Note: the failing gh-pages check is unrelated to the changes in this PR. Installing the pinned decasify.sile 0.11.2-1 pulls in its unpinned transitive dependency decasify, which now resolves to 0.11.4 and requires rustc 1.96 — but the nixpkgs revision pinned in flake.lock only provides rustc 1.91.1. A CI run on master would currently fail the same way (the last successful run was in December).

Comment thread flake.nix Outdated
Comment thread Makefile Outdated
Comment thread .gitignore
Comment thread data/title-case/glu.md Outdated
Comment thread data/superscript/glu.html Outdated
Comment thread data/prime-symbol/glu.md Outdated
Comment thread data/italic-correction/glu.html
Comment thread data/page-geometry/glu.html Outdated
@alerque

alerque commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Is there anything that comes to mind that Glu accomplishes that other typesetters can't handle, something that it makes trivially easy that would be complex in other typesetters, or that it has some unique idiomatic way of handing that people comparing engines for prospective use might be interested to know? If such a thing comes to mind it's totally appropriate to add a new sample to showcase that.

@pgundlach

Copy link
Copy Markdown
Contributor Author

Is there anything that comes to mind that Glu accomplishes that other typesetters can't handle, something that it makes trivially easy that would be complex in other typesetters, or that it has some unique idiomatic way of handing that people comparing engines for prospective use might be interested to know? If such a thing comes to mind it's totally appropriate to add a new sample to showcase that.

Nothing really visible:

  • Accessibliity (PDF/UA-2 is not on by default). But this cannot be shown in the PDF output. All documents including math should by default be correctly tagged PDF.
  • since glu is just a frontend to a Go library, it can easily be embedded in Go programs
  • It contains some TeX algorithms, but this plays in the same league as the other presented tools, so nothing to add...

Comment thread templates/menu.html
@alerque
alerque force-pushed the feature/glu branch 3 times, most recently from aa53219 to e967049 Compare August 24, 2026 10:12
Comment thread Makefile
Comment thread content/title-case.md Outdated
Comment thread data/dropcaps/glu.html
Comment thread data/dropcaps/glu.html Outdated
Comment thread data/hieroglyphs/glu.html
Comment thread data/prime-symbol/glu.md
Comment thread data/superscript/glu.html Outdated
Comment thread data/varlimits/glu.html Outdated
Comment thread data/superscript/glu.html Outdated
Comment thread data/dropcaps/glu.html Outdated
Comment thread data/dropcaps/glu.html Outdated
pgundlach and others added 16 commits August 25, 2026 19:55
glu renders Markdown, HTML, or Lua straight to PDF on top of the
boxes and glue typesetting library (OpenType shaping, Knuth-Plass
line breaking, an OpenType MATH engine and CSS Paged Media support).

Co-authored-by: Caleb Maclennan <caleb@alerque.com>
Polytype consumes glu as a flake input pinned via flake.lock;
the input follows polytype's nixpkgs to avoid a second evaluation.

Specifically this uses the latest glu 0.0.30 release which includes
fixes highlighted by early attempts at these samples.

* inline @page rules in Markdown mode are honored (boxesandglue/glu#1),
  and vertical-align: super/sub now shifts by a fraction of the parent's
  font size with length values supported (boxesandglue/glu#2). A
  relative css: path in the Markdown front matter now resolves against
  the document instead of the working directory (boxesandglue/glu#3),
  and htmlbag 0.0.40 reports font families that lack an @font-face
  registration.

* The hello-world sample's @bottom-center page number, silently dropped
  by 0.0.29's Markdown path, now shows up without any source change.

Co-authored-by: Caleb Maclennan <caleb@alerque.com>
Glu does not support loading system fonts, and the Nix provided location
is hard to reach with an absolute path link, so in the interest of
making the samples easy to grok we're serving up a special local copy.
While Glu can't import the Lua module for decasify (since it cannot load
C modules) this shells out to the decasify CLI from a Lua block, thereby
achieving something like an extension and effectively reusing the same
locale-aware library as the SILE and Typst samples.

Co-authored-by: Caleb Maclennan <caleb@alerque.com>
Glu has no fontconfig support and resolves font families only through
@font-face rules with explicit file paths. Generate glufonts.css from
fc-list at build time and pass it to every glu invocation via --css,
so the samples reference fonts by family name like the other engines
and the extra Libertinus download can go away.

Co-authored-by: Caleb Maclennan <caleb@alerque.com>

@alerque alerque left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a bunch more minor tweaks, mostly to remove irrelevant CSS or simplify the styling (e.g. 1em instead of 0.9em where the exact size seemed arbitrary, dropping irrelevant rules, etc.). Your LLM use really jinxed this PR. Many of the values it set were not only unnecessary but actively made the display of the samples worse than defaults! I honestly suspect I spent more time cleaning up after the LLM than it would have taken you to write clean samples yourself given your expertise in the engine.

The remaining nitpicks are either things that I need to fix or clean up across all of the engines or things that should fix themselves when Glu fixes bugs or adds features.

Assuming those changes are okay with you I think this is good to go. I'm just working on fixing CI on master before merging.

Also feel free to continue adding samples or submitting improvements to the existing ones, especially as Glu adds features. I'd just ask that you actually review the LLM generated code and are ready to defend or explain it rather than making me review and point out its obvious buffoonery.

@alerque
alerque merged commit ae20c92 into alerque:master Aug 25, 2026
@pgundlach

Copy link
Copy Markdown
Contributor Author

Thank you very much for your huge amount of time and effort, very much appreciated. The change are fine with me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants