CffFont Class
A font program in the Compact Font Format (Adobe Technical Note #5176) on its own, not in an OpenType font: a .cff file, or a program embedded in a PDF document (/FontFile3, Type1C and CIDFontType0C). It gives the names (or the CIDs) of the glyphs, the built-in encoding, the font matrix and the outlines.
public sealed class CffFontRemarks
Only the first font of the program is read. The glyphs of a CID-keyed font are found by their CIDs, the glyphs of the other fonts by their names or their codes. The seac operator (a base character and an accent, Adobe Technical Note #5177, appendix C) is drawn from the glyphs the standard encoding gives to its codes.
The object is immutable and can be used from several threads.
Properties
| Name | Description |
|---|---|
| FontMatrix | Gets the matrix from the units of the outlines to text space, as the six values a b c d e f: the one of the font dictionary of a CID-keyed font multiplied by the one of the Top DICT, or 0.001 0 0 0.001 0 0 by default. |
| GlyphCount | Gets the number of glyphs of the font. |
| IsCidKeyed | Gets a value indicating whether the font is CID-keyed: its glyphs are found by their CIDs, not by their names. |
FontMatrix
CffFont.csGets the matrix from the units of the outlines to text space, as the six values a b c d e f: the one of the font dictionary of a CID-keyed font multiplied by the one of the Top DICT, or 0.001 0 0 0.001 0 0 by default.
public IReadOnlyList<double> FontMatrix { get; }Property value
GlyphCount
CffFont.csIsCidKeyed
CffFont.csMethods
| Name | Description |
|---|---|
| DecodeOutline(int, OutlineSink, GlyphBudget) | Decodes the outline of a glyph, in the units of the outlines (see CffFont.FontMatrix). A glyph identifier that is not a glyph of the font draws nothing. |
| GetGlyphByCid(int) | Gets the glyph of a CID: through the charset of a CID-keyed font, the CID itself otherwise. |
| GetGlyphByCode(int) | Gets the glyph of a code in the built-in encoding of a font that is not CID-keyed (the standard encoding when the program has none). |
| GetGlyphByName(string) | Gets the glyph of a name in the charset of a font that is not CID-keyed. |
| GetGlyphName(int) | Gets the name of a glyph in the charset of a font that is not CID-keyed. |
| Load(ReadOnlySpan<byte>) | Reads a CFF font program. |
DecodeOutline(int, OutlineSink, GlyphBudget)
CffFont.csDecodes the outline of a glyph, in the units of the outlines (see CffFont.FontMatrix). A glyph identifier that is not a glyph of the font draws nothing.
public void DecodeOutline(int glyphId, OutlineSink sink, ref GlyphBudget budget)Parameters
glyphIdint- The glyph.
sinkOutlineSink- The receiver of the contours.
budgetGlyphBudget- The limits of the work of the decoding (the operators of the charstrings, the subroutine calls).
Exceptions
InvalidFontException- The charstring of the glyph is malformed, or it exceeds the budget.
GetGlyphByCid(int)
CffFont.csGetGlyphByCode(int)
CffFont.csGetGlyphByName(string)
CffFont.csGetGlyphName(int)
CffFont.csLoad(ReadOnlySpan<byte>)
CffFont.csReads a CFF font program.
public static CffFont Load(ReadOnlySpan<byte> data)Parameters
dataReadOnlySpan<byte>- The bytes of the program, starting with the CFF header. They are copied.
Returns
CffFont The font.
Exceptions
InvalidFontException- The program is not a valid CFF program.