Struct allsorts_no_std::cff::CFF [−][src]
Top level representation of a CFF font file, typically read from a CFF OpenType table.
Refer to Technical Note #5176
Fields
header: Header
name_index: Index<'a>
string_index: MaybeOwnedIndex<'a>
global_subr_index: Index<'a>
fonts: Vec<Font<'a>>
Implementations
impl<'a> CFF<'a>
[src]
pub fn read_string(&self, sid: u16) -> Result<String, ParseError>
[src]
Read a string with the given SID from the String INDEX
pub fn subset(
&self,
glyph_ids: &[u16],
convert_cff_to_cid_if_more_than_255_glyphs: bool
) -> Result<(Self, Vec<u16>), ParseError>
[src]
&self,
glyph_ids: &[u16],
convert_cff_to_cid_if_more_than_255_glyphs: bool
) -> Result<(Self, Vec<u16>), ParseError>
The Vec<u16>
in the output is a mapping from new to old glyph id.
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.
Trait Implementations
impl<'a> Clone for CFF<'a>
[src]
impl<'a> ReadBinary<'a> for CFF<'a>
[src]
impl<'a> WriteBinary<&'_ CFF<'a>> for CFF<'a>
[src]
type Output = ()
The type of the value returned by write
.
fn write<C: WriteContext>(ctxt: &mut C, cff: &CFF<'a>) -> Result<(), WriteError>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for CFF<'a>
impl<'a> Send for CFF<'a>
impl<'a> Sync for CFF<'a>
impl<'a> Unpin for CFF<'a>
impl<'a> UnwindSafe for CFF<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T> ReadBinaryDep<'a> for T where
T: ReadBinary<'a>,
[src]
T: ReadBinary<'a>,
type Args = ()
type HostType = <T as ReadBinary<'a>>::HostType
pub fn read_dep(
&mut ReadCtxt<'a>,
<T as ReadBinaryDep<'a>>::Args
) -> Result<<T as ReadBinaryDep<'a>>::HostType, ParseError>
[src]
&mut ReadCtxt<'a>,
<T as ReadBinaryDep<'a>>::Args
) -> Result<<T as ReadBinaryDep<'a>>::HostType, ParseError>
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, HostType> WriteBinaryDep<HostType> for T where
T: WriteBinary<HostType>,
[src]
T: WriteBinary<HostType>,
type Args = ()
The type of the arguments supplied to write_dep
.
type Output = <T as WriteBinary<HostType>>::Output
The type of the value returned by write_dep
.
pub fn write_dep<C>(
&mut C,
HostType,
<T as WriteBinaryDep<HostType>>::Args
) -> Result<<T as WriteBinaryDep<HostType>>::Output, WriteError> where
C: WriteContext,
[src]
&mut C,
HostType,
<T as WriteBinaryDep<HostType>>::Args
) -> Result<<T as WriteBinaryDep<HostType>>::Output, WriteError> where
C: WriteContext,