Skip to content
PressJetDocs Docs v0.1.0-beta.9 GitHub
Edit this page
Source docs v0.1.0-beta.9 Install v0.1.0-beta.7
On this page

Advanced typography

Pressjet composes a paragraph from shaped glyphs, inline objects and Unicode break opportunities. The development engine uses HarfRust 0.12. Beta 7 used Rustybuzz and already supported OpenType shaping, bidirectional text, First Fit and discretionary soft hyphens. Engine dependencies · Beta 7 text implementation

Shape character runs

Styled text becomes logical runs segmented by direction, style, font coverage and script. HarfRust shapes each run into glyph IDs, clusters, advances and offsets. OpenType GSUB handles substitutions such as contextual forms and ligatures. GPOS handles positioning such as mark placement and kerning. GDEF supplies glyph classes and related lookups. The shaper follows the face's tables and default features. Pressjet does not expose general per-run OpenType feature toggles or variable-font axes. Skrifa reads character maps and metrics, and Krilla embeds font subsets when writing the PDF. Source cluster mappings let the painter associate glyphs with original text. Font and shaping code · Text pipeline · PDF glyph painting

The layout layer keeps source UTF-8 and cluster ranges. It does not rewrite whole paragraphs to a chosen Unicode normalization form. The shaper can normalize internally as part of shaping. Pressjet resolves embedding levels with unicode-bidi, reorders per physical line, and reshapes Arabic fragments where a line break changes joining. The regression suite covers Arabic and Hebrew with embedded Latin or numbers. Coverage for a script depends on the actual font. The cache equivalence tests include additional scripts and combining sequences, with broader visual, extraction and assistive-technology coverage still open. Complex writing modes and browser-equivalent dir or unicode-bidi styling are outside the documented surface. Paragraph tests · Chromium comparison corpus · Unicode bidi algorithm

Compose lines and pages

Paragraph composition measures shaped clusters and inline image dimensions. The unicode-linebreak iterator supplies Unicode line-break opportunities. First Fit greedily packs clusters up to the available width and breaks at the last eligible boundary. Explicit newlines are respected. Trailing spaces do not contribute to the line width, an overlong token can break at a shaping cluster boundary, and U+00AD displays a hyphen only at a chosen break. Justification expands eligible spaces on non-final lines. There is no dictionary hyphenation, paragraph-wide Knuth–Plass optimization, or Arabic-specific justification. The separate draw flow uses a simpler whitespace wrapper. Line-breaking and justification tests · Flow writer · Unicode line breaking

The paginator consumes line ranges and enforces the available height, orphans, widows, keep rules and explicit breaks. Pagination reuses measured lines when the width and layout permit. For a page in a narrow column, look at check findings for broken words, overflow and missing glyphs, and use development inspect to inspect the resolved fonts and cuts. Pagination and tests · Layout diagnostics · Inspection schema

Choose and register fonts

Font selection uses family, style and weight. Built-ins include Archivo, aliases for Liberation Sans, Serif and Mono, and DejaVu Sans for extra symbols. A family list chooses the first known family. Glyph fallback then tries the selected face, Liberation Sans and DejaVu Sans. Test representative text with the real fonts for each language and watch for font_substituted and missing_glyph.

  • Native JSON can include request fonts with embeddable TTF or OTF bytes. In CLI input, you can point to a supported local file. The server and CLI load deployment fonts from PRESSJET_FONTS_DIR.
  • HTML can register fonts with @font-face using inline or supplied bytes. The rendering engines do not fetch font URLs. Use Renderer::add_font to register fonts in a Rust renderer instance. Browser and edge callers supply the supported resource fields with the render request.
  • Pressjet checks embedding permissions in the OpenType OS/2 table and refuses restricted faces. Its admission check does not enforce every high-bit restriction. Confirm that the font license allows your use, redistribution, embedding and subsetting before you deploy it.

Resource formats and examples · Font admission and tests · Deployment font loader · Bundled font notices

Reuse and bound expensive work

On main, built-in fonts load lazily from static bytes. Installed faces are shared per process. Request font-cache keys include the caller scope, face metadata and a content digest. The cache is bounded by entry count and estimated bytes. Admission bounds source size and shaping metadata, including expanded OpenType tables. A face retains its HarfRust shaper data and a small set of plans keyed by script, direction and language. Short runs can reuse a thread-local shaping buffer. The layout shares paragraph spans and line results and the paginator refers to shared ranges. Tests compare cached and fresh glyph output, enforce cache budgets and compare full and windowed pagination. These checks cover implementation equivalence and bounds for their fixtures. Cache and plan tests · Shared layout text · Pagination