A Row of Glyphs Asked for by Their Number
Set the shapes a font holds by their number in the file — the forms no key reaches — and say what each one stands for when it is copied.
See It in a Real PDF
What a Font Knows about Its Own Letters
Five samples set twice each, once plain and once with a single setting activated: joined letters, small capitals, figures that hang below the line, the letters one language draws its own way, and pairs moved closer together.
Summary
A font holds more shapes than there are letters to type: a second form of a letter, a swash capital, an ornament, a figure cut for one language. No key on a keyboard reaches them, so a text cannot ask for them. This item asks for them by the number each has inside the font file and sets them in a row. For each one you may also say what it stands for, so that somebody copying the row, or searching the page, finds words rather than nothing.
Technically
Asked for with
"type": "glyphs"
A glyphs item sets one line of a font's glyphs by their index in the font program, the numbers a composite font writes into the page. A glyph copies out as the character the font's own map leads to it from, and as nothing where no character does; a glyph given stands_for copies, is searched and is read aloud as that text instead, written into the font's ToUnicode map. A glyph stands for one text in a document, the first one stated for it. A font reached through one-byte codes has no glyph number to reach and is refused.
Request Schema
Required keys: rect; glyphs, an array whose entries are each a glyph's number in the font file, or an object of glyph, that number, and stands_for, a string of at most 256 UTF-16 code units, what the glyph copies out as; font, the name of a declared font; font_size, in points. Optional: align, left (default), center or right, justify setting the row from the left edge; color (default black); pages, an array of one-based integers, default empty; transform, six numbers; rotate, degrees counter-clockwise about the centre of the rectangle; layer, the name of a declared layer; tag with mark, or artifact; facts. The row's baseline sits 1.2 × font_size under the top of rect. Cross refusals: transform together with rotate; tag together with artifact; an object carrying a key other than glyph and stands_for; a number the font holds no glyph at. Between two glyphs, {"move": n} moves the pen by that many thousandths of an em of font_size, a positive move bringing the next glyph closer and a negative one pushing it away: the spacing a program that shaped its text itself writes, which the width of a center or right row counts.
A Whole Request That Creates a PDF
One name below stands for a font file: put the encoded file in its place, or send the file itself beside the description, as a supplied part of the same call. One page carries a real font already encoded, and its request posts as it stands.
{
"fonts": [{ "name": "body", "data": "PASTE_THE_FONT_FILE_BASE64_HERE" }],
"items": [
{
"type": "glyphs",
"rect": { "llx": 72, "lly": 700, "urx": 523, "ury": 740 },
"glyphs": [36, 37, 38, { "glyph": 5042, "stands_for": "fi" }],
"font": "body",
"font_size": 24,
"align": "center"
}
]
}
Text
A Block of Text Placed on the Page Text in Paragraphs, with Indents and Tab Stops A Stamp Laid across the Page A Line of Words Set Along a Path Blocks Laid One under the Other, Page After Page
Where to Go Next
Every JSON key of a request, in one page The other twenty-two things you can draw