P4 Software
/
BarcoderX English
Applies to: BarcoderX Basic and Ultimate
Status: Built, not yet released. The font reader exists and is tested, but nothing is released yet and there is nothing to download. It opens and checks a font file. Drawing text with the font, kerning, ligatures and embedding a font in a PDF are not built yet. This page says what the reader does today.
Before BarcoderX uses a font, it opens the font file and checks it. This page explains what BarcoderX reads, which files it accepts, which it rejects and why, and the limits it applies. How fonts reach BarcoderX, and the rules for uploading them, are in Text, fonts and pictures.
BarcoderX reads fonts with its own code. It never asks the operating system to open a font.
A font file is a set of named tables. BarcoderX reads these:
| Table | What it holds | What BarcoderX does with it |
|---|---|---|
head, hhea, maxp | The font's size grid, its overall spacing and the number of glyphs | Reads the values and checks that they agree with each other |
hmtx | How wide each glyph is | Reads the width of each glyph |
cmap | Which glyph draws which character | Reads a Unicode character map, in format 4 or 12 |
loca, glyf | Where each glyph's shape is, and the shape itself, as straight lines and curves | Reads every shape and checks it |
OS/2 | Extra spacing values and the font's embedding permission | Reads the header and the embedding permission |
name, post | The font's name, and information for printing | Checks that the table exists and has a valid start; does not read its content yet |
A glyph is the drawn shape of one character. A shape is stored as an outline, a closed line made of straight pieces and curves. Some glyphs are built from other glyphs, such as an accented letter built from a plain letter and an accent. These composite glyphs work, including parts that are scaled, stretched or turned.
.ttf file, or an .otf file whose outlines are TrueType.Every rejection comes with a diagnostic code that says what is wrong and what to do. The list is in Diagnostic codes.
| What | Why |
|---|---|
| A file that does not look like a font | The start of the file is not a known font signature. |
Fonts with CFF outlines (some .otf files) | Not supported yet. Use a font with TrueType outlines. |
Font collections (.ttc) | Upload one font file at a time. |
Web fonts (.woff and .woff2) | Upload the .ttf or .otf file instead. |
| Fonts with color, SVG or bitmap glyphs, such as emoji fonts | Only outline glyphs are supported. |
| A font without a required table | The font cannot be used without it. |
| A damaged, cut-off or inconsistent file | Tables that overrun the file, overlap, repeat or are not aligned; counts and sizes that disagree; shapes that are broken; a character map that points at a glyph that does not exist. |
| A file with wrong checksums | A checksum is a number that detects a damaged or changed file. By default BarcoderX checks the checksum of every table and of the whole file. |
| A glyph that is built from itself, nests too deeply or has too many parts | These are signs of a damaged or hostile file. |
| A glyph that places one part by matching two points | This way of placing parts is rare and is not supported yet. |
| A font that needs too much checking work | The checking has a work budget so that one font cannot keep the computer busy for long. |
Three cases do not reject a font. BarcoderX uses the font anyway and tells you with a message: a warning if the tables are listed out of order or the character map lacks its closing entry, and an information message if the font is a variable font.
| Limit | Value |
|---|---|
| Size of a font file | 10 MB |
| Glyphs in one font | 65,535 |
| Points in one glyph | 10,000 |
| Nesting of composite glyphs | 8 levels |
| Parts that one glyph expands to | 256 |
| Tables in one font | 128 |
| Checking work for one font | 50 million units |
The limits are checked before the memory they protect is allocated. In BarcoderX's automatic tests, more than a million damaged variations of a font file are fed to the reader on every run, and none of them may crash it or make it use too much memory or time.
BarcoderX is a product of P4 Software.
Was this page helpful?