The typographic niceties of a face
Turn on ligatures, small capitals, oldstyle figures or kerning for a face, under a new name of its own.
Written at the top level of a request, under
"font_variants"
In plain words
Written for anybody. It says what this puts on a sheet of paper, and asks nothing of you beyond that.
A good typeface hides refinements that books have used for centuries. Some pairs of letters are drawn in one stroke so they do not bump into each other. Capitals can be small, the height of lowercase letters, for a quiet heading. Figures can rise and fall like letters instead of standing all in a row. And the space between two letters can close up where the typeface asks for it. You turn on what you want, and you get one more typeface, under a name of your own.
For a developer
Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.
font_variants builds one more font from another, with typographic settings turned on, and makes it available under its own name. The original font stays as it is: both live side by side in the same request. The four settings turn on separately, which is what lets the same text be shown with and without. The base font is an embedded font, a client font or a library font.
Every key, with its default
The reference: which keys are required, which are optional, what each one defaults to and which combinations the server declines.
-
font_variants— array, optional, empty by default. -
font_variants[].name— string, required. The variant's name. -
font_variants[].from— string, required. The name of the original font: an embedded font (fonts), a client font, or a font of the server's library. -
font_variants[].ligatures— boolean, optional,falseby default. Joins the pairs of letters the font draws as one shape. -
font_variants[].small_capitals— boolean, optional,falseby default. Draws lowercase letters as small capitals. -
font_variants[].oldstyle_figures— boolean, optional,falseby default. Draws figures rising and falling like lowercase letters. -
font_variants[].kerning— boolean, optional,falseby default. Closes up each pair by what the font says about it.
What the variant delivers rests on the tables the font carries: a font with no ligature table draws the same text as its base. A name another font already holds is refused.
A whole request that draws it
Post this as it stands and a PDF comes back. Nothing has been left out of it.
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 part of the same call.
{
"fonts": [{ "name": "body", "data": "PASTE_THE_FONT_FILE_BASE64_HERE" }],
"font_variants": [
{ "name": "body_small_capitals", "from": "body", "small_capitals": true }
],
"items": [
{
"type": "text",
"rect": { "llx": 60, "lly": 740, "urx": 535, "ury": 765 },
"content": ["Chapter one"],
"font": "body_small_capitals",
"font_size": 16
}
]
}
The lettering
Carrying a font inside the document The older Type 1 font programs The fourteen faces every reader owns A face whose letters you draw yourself A backup face for the rarer signs
Where to go next
Every key of a request, in one page The other thirty-two settings of a request
Glossary
- PDF library
- A piece of software your own programs use to write PDF documents. It has no window and no buttons: your program tells it what to draw, and it hands the finished file back. This site also calls it the engine, which is the same thing under another name. The server is a second program that holds the engine and answers whoever asks it for a document over the network, and the rendering service is that server running on our machines rather than on yours.
- font
- The drawing of every letter, digit and mark a document writes, held in a file of its own. A PDF carries the fonts it is set in inside itself, which is why it opens looking the same on a machine that has never had them. Leave them out and a reader puts another font in their place, and the layout moves.
- request
- One call to the service: you send what the document should say, and get the document back. Your bill counts these calls, one for each document. The number of pages inside a document is never counted.
- server
- A machine that waits for calls and answers them, running day and night with nobody sitting at it. The one that draws documents here holds the engine and hands back the finished pages; the one your website runs on is a different machine doing the same kind of job.
- kerning
- Closing up the gap between two particular letters that would otherwise sit too far apart, such as a capital A after a capital T. The typeface itself carries the list of pairs.
- ligature
- Two letters drawn as one shape because they collide when set separately, as an f followed by an i does. The typeface carries the joined drawing.