logo
pub struct CFF<'a> {
    pub header: Header,
    pub name_index: Index<'a>,
    pub string_index: MaybeOwnedIndex<'a>,
    pub global_subr_index: Index<'a>,
    pub fonts: Vec<Font<'a>>,
}
Expand description

Top level representation of a CFF font file, typically read from a CFF OpenType table.

Refer to Technical Note #5176

Fields

header: Headername_index: Index<'a>string_index: MaybeOwnedIndex<'a>global_subr_index: Index<'a>fonts: Vec<Font<'a>>

Implementations

glpyh_ids contains the ids of the glyphs to retain. When subsetting a Type 1 CFF font and retaining more than 255 glyphs the convert_cff_to_cid_if_more_than_255_glyphs argument controls whether the Type 1 font is converted to a CID keyed font in the process. The primary motivation for this is broader compatibility, especially if the subset font is embedded in a PDF.

Known Limitations

Currently the subsetting process does not produce the smallest possible output font. There are various parts of the source font that are copied to the output font as-is. Specifically the subsetting process does not subset the String INDEX, or the Local or Global subroutines.

Subsetting the String INDEX requires updating all String IDs (SID) in the font so that they point at their new position in the String INDEX. Subsetting the subroutines requires parsing the CharStrings, which describe the glyph outlines. The CharStrings format is non-trivial so this has been left for now.

Read a string with the given SID from the String INDEX

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Converts to this type from the input type.

Visit the glyph outlines in self.

The type of the value returned by write.

Write the binary representation of Self to ctxt.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type of the arguments supplied to write_dep.

The type of the value returned by write_dep.

Write the binary representation of Self to ctxt.