Specimen · Volume One

PrintCraft
Showcase

A tour of the page, glyph by glyph.

Typography, world scripts, vector graphics, mathematics, forms and annotations — gathered in one document to put a PDF engine through its paces.

PdfCraft
Open-source PDF toolkit in Rust
Generated by cargo xtask demo-pdf
US Letter · 8.5 × 11 in
PdfCraft ShowcaseContents
Inside this specimen

Contents

  1. 1Setting TextColumns, justification, hyphenation, drop caps and notes1
  2. 2OpenType FeaturesLigatures, small capitals, figures, fractions, swashes, weights2
  3. 3Expressive TypeShadows, gradients, rotation, skew and text on a path3
  4. 4Scripts of the WorldRight-to-left, complex shaping, vertical CJK and emoji4
  5. 5MathematicsMathML Core set in STIX Two Math5
  6. 6Vector GraphicsShadings, blend modes, clipping, masks and patterns6
  7. 7Data & TablesCharts and a striped feature matrix7
  8. 8Code & ImagesA syntax-coloured listing and a generated raster8
  9. 9Review & MarkupEvery common annotation type, with appearance streams9
  10. 10Interactive FormAcroForm fields written directly by the xtask10

Colophon

Body text is set in EB Garamond with Playfair Display for display, Inter for labels, and JetBrains Mono for code. Every font is openly licensed (OFL) and listed in ATTRIBUTION.md. Layout is authored in HTML and CSS, printed by headless Chrome, then post-processed with lopdf.

What to look for

Open the bookmarks, layers, attachments and comments panels. Page labels run Cover, i–ii, then 1–10. One layer adds a draft watermark; another holds print-only notes and starts hidden.
PdfCraft Showcasei
PdfCraft ShowcaseForeword
Foreword

Why a specimen?

A PDF reader is judged in the first second. The page appears, and either the letters sit on it the way the author intended or they do not. Every kerning pair, every ligature and every soft gradient is a small promise the file makes and the renderer must keep.

This document collects those promises in one place. It was written for the people who build PdfCraft, as a single file to open after every change: if all of it still looks right, the change is probably safe. It is also, we hope, pleasant to read on its own.

Nothing here is exotic. Each feature is something ordinary documents use every day — an invoice with a form field, a thesis full of equations, a contract with comments in the margin, a brochure with a translucent photograph laid over a tinted panel. What is unusual is only that they are all together, and that each page says plainly what it is testing.

The layout is authored in HTML and printed by a browser; the interactive parts are then written into the file by hand, object by object. That split mirrors the real world, where most PDFs are produced by one program and amended by several others.

The PdfCraft contributors

Tracking, from tight to airy

Measure twice, set once −40
Measure twice, set once 0
Measure twice, set once +120
Measure twice +300

The families in this specimen

AgPlayfair DisplayDisplay
AgEB GaramondBody text
AgInterLabels
AgJetBrains MonoCode
AgGreat VibesScript
∑xSTIX Two MathMathematics
Forewordii
PdfCraft Showcase1 · Setting Text
Chapter one

Setting Text

Two justified columns with automatic hyphenation, old-style figures, a drop cap and a pull quote — the everyday machinery of a well-made page.

Long before there were screens, a page of type was a negotiation between the width of a column and the length of the words that had to fill it. The compositor adjusted spaces, divided a word at a sensible syllable, and occasionally rewrote a line so the paragraph would lie flat. Justified text asks for exactly that care, and a renderer must honour the spacing it was given.1

A PDF does not reflow. Every glyph has already been placed by the program that wrote the file, and the reader’s job is to reproduce those positions faithfully at any zoom. That sounds simple until one remembers that a single line may mix three fonts, a ligature standing in for two letters, and a hyphen that exists only because the line happened to break there in 1994 or 2026.

Old-style figures, like the ones in this paragraph’s 1,280 characters and 36 lines, rise and fall with the lowercase so that numbers do not shout. Ligatures such as fi, fl and ffi in words like officially, affluent and afflicted join letters that would otherwise collide.2

“Good typography is noticed only when it is missing.”A working maxim of the trade

Hyphenation is where browsers and word processors differ most. Chrome consults the system’s hyphenation dictionaries when a paragraph declares its language and asks for automatic hyphens, which is why the words in these columns occasionally divide across lines. The result is a more even texture, with fewer rivers of white running down the column.

Columns introduce their own questions: where to break, whether a heading may sit at the foot of one, and how a quotation spanning both should interrupt the flow. Here the pull quote spans the full measure and the text resumes beneath it, balanced between the two columns.

Small text matters too. Notes, captions and legal lines are often set at seven or eight points, where hinting, stem darkening and subpixel positioning decide whether a reader squints. The footnotes below are set at seven and a half points in the same face as the body.3

Finally, notice the drop cap that opens this chapter. It is an ordinary letter, floated and enlarged, with the first line set in small capitals. A renderer need do nothing special for it, which is precisely the point: most typographic richness in a PDF is just careful placement of ordinary glyphs.

1 Word spacing in PDF is usually baked into glyph positions rather than expressed with the word-spacing operator, so readers rarely need to stretch anything themselves.

2 In a PDF a ligature is a single glyph; text extraction relies on the font’s ToUnicode map to recover the letters it represents.

3 Try zooming to 400 percent here: well-rendered small text stays crisp and evenly weighted.

Setting Text1
PdfCraft Showcase2 · OpenType Features
Chapter two

OpenType Features

Each row shows the same text with a feature off, then on. The glyphs differ; the underlying characters do not.

TagFeatureOffOn
ligaStandard ligaturesoffice fluffy fjordoffice fluffy fjord
dligDiscretionary ligaturesAsterisk & strictAsterisk & strict
smcpSmall capitalsPrinted in BostonPrinted in Boston
onumOld-style figuresSince 1885: 3,467,920Since 1885: 3,467,920
fracFractions1/2 cup, 3/4 inch, 7/81/2 cup, 3/4 inch, 7/8
swshSwash capitalsThe Quiet RiverThe Quiet River
ss01Stylistic set 1a 1 4 6 9 G ?a 1 4 6 9 G ?
kernKerningAVATAR Type WaveAVATAR Type Wave
tnumTabular figures1111 / 88881111 / 8888

One variable font, nine weights

Ag100
Ag200
Ag300
Ag400
Ag500
Ag600
Ag700
Ag800
Ag900

System UI · a single variable font file supplies every weight; the PDF embeds each instance as its own subset.

Script faces

Handsome letters, joined in flight
Quietly Ornamental — 1234567890
OpenType Features2
PdfCraft Showcase3 · Expressive Type
Chapter three

Expressive Type

Effects that become transparency groups, soft masks, clipping paths and transformed text objects once they reach PDF.

Layered
text-shadow · two translucent offset copies composited under the glyphs
Spectrum
Gradient-filled text · an axial shading clipped to glyph outlines (text render mode 7)
Skewed
Rotated
transform · skewX(−18°) on a filled box and rotate(−12°) on a label
Outline
Tracked to 600
-webkit-text-stroke · glyphs stroked, not filled (render mode 1)

Text on a curve

Letters can follow any path the designer draws — up, over, and away

SVG textPath · each glyph is positioned and rotated individually along a cubic Bézier, filled with a gradient.

Hierarchy through contrast

Contrast is the
engine of design.
Pair a high-contrast Playfair italic with a heavy grotesque and the eye knows where to go. The PDF sees only two fonts and a handful of positioning operators; the hierarchy is entirely in the choices.
Expressive Type3
PdfCraft Showcase4 · Scripts of the World
Chapter four

Scripts of the World

A short greeting — roughly, “every letter deserves a good home” — in writing systems that need bidirectional layout, contextual shaping, reordering and vertical setting.

Arabic RTL · joining
لكل حرف بيت
Amiri
Hebrew RTL
לכל אות יש בית טוב
Noto Sans Hebrew
Devanagari conjuncts
हर अक्षर का घर
Noto Sans Devanagari
Thai no spaces
ทุกอักษรมีบ้าน
Noto Sans Thai
Greek polytonic
Κάθε γράμμα ἔχει σπίτι
EB Garamond
Cyrillic
Каждой букве — дом
EB Garamond
Chinese simplified
每个字都有家
ZCOOL XiaoWei
Korean Hangul
모든 글자에 집을
Gowun Batang
IPA phonetics
/taɪp ɪz ˈkræft/
International Phonetic Alphabet
Armenian
Ամեն տառին՝ տուն
Noto Sans Armenian
Georgian
ყველა ასოს — სახლი
Noto Sans Georgian
Tamil
எழுத்துக்கு வீடு
Noto Sans Tamil
Japanese
Shippori Mincho, writing-mode: vertical-rl

Mixed direction in one line

The word كتاب means “book”, and ספר does too — the bidi algorithm keeps each run in its own direction while the sentence stays left-to-right, even across numbers like ٣٤٥ and 345.

Colour emoji

📄🖋️🎨📐🔍🌍🧮✅🦀📎

Noto Color Emoji (OFL) · colour bitmap glyphs that Chrome places into the PDF as images.

Scripts of the World4
PdfCraft Showcase5 · Mathematics
Chapter five

Mathematics

Equations written in MathML Core and laid out by the browser: stretchy delimiters, radicals, large operators, scripts and matrices.

x=−b±b2−4ac2a
Quadratic formula · fraction, radical, superscript
∫−∞∞e−x2dx=π
Gaussian integral · large operator with limits
eiπ+1=0
Euler’s identity · five constants, one line
∑n=1∞1n2=π26
Basel problem · summation with under- and over-scripts
R(θ)=[cosθ−sinθsinθcosθ]
Rotation matrix · the transform behind every rotated page
B(t)=∑i=03(3i)(1−t)3−itiPi
Cubic Bézier · the curve PDF paths are made of

Inline mathematics

A PDF page maps user space to device space with a matrix [abcdef], so a point (x,y) lands at (ax+cy+e,bx+dy+f). With one point equal to 172 inch, a Letter page measures 612×792 points, and a 300 dpi raster of it holds roughly 8.4×106 pixels.

Symbols and arrows

∀ ∃ ∅ ∇ ∂ ∈ ∉ ⊂ ⊆ ∪ ∩ ≤ ≥ ≠ ≈ ≡ ∞ ℵ ℝ ℂ ℤ ℕ → ⇒ ⇔ ↦ ⟨ ⟩ ⌈ ⌉
Mathematics5
PdfCraft Showcase6 · Vector Graphics
Chapter six

Vector Graphics

Nine small plates, each exercising one piece of the PDF imaging model.

Axial shading · three-stop linear gradient
Radial shading · off-centre focal point
Multiply · subtractive overlaps, /BM /Multiply
Screen · additive light, /BM /Screen
Clip
Clipping path · glyph outlines as a clip
Soft mask · luminosity gradient fades artwork
Dash patterns · caps, joins and phase
Tiling patterns · checks and rotated hatch
Fill rules · even-odd pentagram, 45% opacity

Layered waves · five-stop shading, 50% overlay in multiply mode, dashed stroke over the top.

Vector Graphics6
PdfCraft Showcase7 · Data & Tables
Chapter seven

Data & Tables

Charts drawn as SVG and a striped table. All figures are illustrative sample data, not measurements.

Pages per second, by document type

Illustrative sample data · higher is better

050100150200 189139947043 TextFormsVectorScansMaps

Renderer conformance over releases

Illustrative sample data · % of test pages matching reference

60708090100 0.10.20.30.40.5 Text 97Vector 92Forms 85
Text Vector Forms

Where each PDF feature lives in this file

FeaturePDF objectProduced byPageStatus
Embedded font subsets/FontFile2, /FontFile3ChromeallPresent
Tagged structure/StructTreeRootChromeallPresent
Axial & radial shadings/ShadingType 2, 3Chrome6Present
Blend modes/ExtGState /BMChrome6Present
Bookmarks/OutlinesChrome, xtask—Present
Page labels/PageLabelsxtask—Present
Optional content/OCPropertiesxtask9, 10Two layers
Annotations/Annots with /APxtask1, 9, 10Present
Form fields/AcroFormxtask10Present
File attachments/EmbeddedFilesxtask—Present
Digital signature/FT /Sigxtask10Unsigned
Data & Tables7
PdfCraft Showcase8 · Code & Images
Chapter eight

Code & Images

A monospaced listing with syntax colouring, and the raster that it describes.

1// Escape-time rendering of Seahorse Valley into an RGB buffer.
2fn mandelbrot(width: u32, height: u32) -> Vec<u8> {
3    let mut rgb = Vec::with_capacity((width * height * 3) as usize);
4    for py in 0..height {
5        for px in 0..width {
6            let c = (CX + SPAN * (px as f64 / width as f64 - 0.5),
7                     CY - SPAN * (py as f64 / height as f64 - 0.5));
8            let (mut z, mut n) = ((0.0, 0.0), 0);
9            while n < MAX_ITER && z.0 * z.0 + z.1 * z.1 <= 4.0 {
10               z = (z.0 * z.0 - z.1 * z.1 + c.0, 2.0 * z.0 * z.1 + c.1);
11               n += 1;
12           }
13           rgb.extend_from_slice(&palette(n)); // smooth colour ramp
14       }
15   }
16   rgb
17}
Procedurally generated Mandelbrot set

A generated raster

The image at left is computed by the xtask each time the showcase is built, encoded as PNG and handed to Chrome, which embeds it as an image XObject. Nothing is downloaded and no third-party artwork is involved, so the file stays reproducible and free to redistribute.

At 60 dpi the fractal edge looks smooth; zoom in and the individual pixels appear, a useful check that the viewer switches from filtered to nearest-neighbour sampling at the right moment.

Links

Code & Images8
PdfCraft Showcase9 · Review & Markup
Chapter nine

Review & Markup

Every annotation on this page was added after printing, each with its own appearance stream, author, date and unique name.

Text markup

Reviewers rarely rewrite a document; they highlight the phrase that matters, underline a claim that needs a source, and strike out a redundant word before moving on.

A wavy line says check the spelling here, while a caret marks where text should  be inserted.

Comments

Sticky notes carry threaded replies, and a free-text box writes directly on the page. The paperclip holds an attached file that can be saved from the comment itself.

Legend

  1. Highlight
  2. Underline
  3. StrikeOut
  4. Squiggly
  5. Caret
  6. Text + Popup
  7. FreeText
  8. Line (arrow)
  9. Square
  10. Circle
  11. Polygon
  12. PolyLine
  13. Ink
  14. Stamp
  15. FileAttachment
  16. Link
Review canvas . . . . . . . . . .
Review & Markup9