Add glu typesetter with samples for all eleven demos - #23
Conversation
|
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. |
|
Note: the failing |
|
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:
|
aa53219 to
e967049
Compare
4f3eebb to
073a396
Compare
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
left a comment
There was a problem hiding this comment.
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.
|
Thank you very much for your huge amount of time and effort, very much appreciated. The change are fine with me! |
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:
glu.md/glu.html/glu.luainputs,mirroring the SILE multi-extension setup, plus a
.fontsdownloadtarget for the Libertinus faces the samples reference.
buildGoModulepackage for glu in the Nix dev shell (glu is notin nixpkgs yet);
unzipjoins the shell inputs for the font target.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).