pub enum CmapSubtable<'a> {
Format0 {
language: u16,
glyph_id_array: ReadArray<'a, U8>,
},
Format2 {
language: u16,
sub_header_keys: ReadArray<'a, U16Be>,
sub_headers: ReadArray<'a, SubHeader>,
sub_headers_scope: ReadScope<'a>,
},
Format4(CmapSubtableFormat4<'a>),
Format6 {
language: u16,
first_code: u16,
glyph_id_array: ReadArray<'a, U16Be>,
},
Format10 {
language: u32,
start_char_code: u32,
glyph_id_array: ReadArray<'a, U16Be>,
},
Format12 {
language: u32,
groups: ReadArray<'a, SequentialMapGroup>,
},
}Variants§
Implementations§
Source§impl<'a> CmapSubtable<'a>
impl<'a> CmapSubtable<'a>
pub fn map_glyph(&self, ch: u32) -> Result<Option<u16>, ParseError>
Sourcepub fn to_owned(&self) -> Option<OwnedCmapSubtable>
pub fn to_owned(&self) -> Option<OwnedCmapSubtable>
Returns an owned::CmapSubtable. Will only return None if self is
CmapSubtable::Format2 as support for converting from this format is not yet implemented.
Sourcepub fn mappings(&self) -> Result<HashMap<u16, u32>, ParseError>
pub fn mappings(&self) -> Result<HashMap<u16, u32>, ParseError>
Extract all the mappings from the sub-table.
The returned HashMap maps glyph indexes to char codes. If more than one char code maps to
the same glyph, the HashMap will contain the first mapping encountered. Also note that
the char code is not necessarily Unicode. It depends on the encoding of the cmap
sub-table.
This method primarily exists to support GlyphNames.
Sourcepub fn mappings_fn(
&self,
callback: impl FnMut(u32, u16),
) -> Result<(), ParseError>
pub fn mappings_fn( &self, callback: impl FnMut(u32, u16), ) -> Result<(), ParseError>
Extract all the mappings from the sub-table.
Trait Implementations§
Source§impl<'b> ReadBinary for CmapSubtable<'b>
impl<'b> ReadBinary for CmapSubtable<'b>
Source§impl<'a> WriteBinary<&CmapSubtable<'a>> for CmapSubtable<'a>
impl<'a> WriteBinary<&CmapSubtable<'a>> for CmapSubtable<'a>
Source§fn write<C: WriteContext>(
ctxt: &mut C,
table: &CmapSubtable<'a>,
) -> Result<(), WriteError>
fn write<C: WriteContext>( ctxt: &mut C, table: &CmapSubtable<'a>, ) -> Result<(), WriteError>
Write the binary representation of Self to
ctxt.Auto Trait Implementations§
impl<'a> Freeze for CmapSubtable<'a>
impl<'a> RefUnwindSafe for CmapSubtable<'a>
impl<'a> Send for CmapSubtable<'a>
impl<'a> Sync for CmapSubtable<'a>
impl<'a> Unpin for CmapSubtable<'a>
impl<'a> UnwindSafe for CmapSubtable<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ReadBinaryDep for Twhere
T: ReadBinary,
impl<T> ReadBinaryDep for Twhere
T: ReadBinary,
type Args<'a> = ()
type HostType<'a> = <T as ReadBinary>::HostType<'a>
fn read_dep<'a>( ctxt: &mut ReadCtxt<'a>, _: <T as ReadBinaryDep>::Args<'_>, ) -> Result<<T as ReadBinaryDep>::HostType<'a>, ParseError>
Source§impl<T, HostType> WriteBinaryDep<HostType> for Twhere
T: WriteBinary<HostType>,
impl<T, HostType> WriteBinaryDep<HostType> for Twhere
T: WriteBinary<HostType>,
Source§type Output = <T as WriteBinary<HostType>>::Output
type Output = <T as WriteBinary<HostType>>::Output
The type of the value returned by
write_dep.Source§fn write_dep<C>(
ctxt: &mut C,
val: HostType,
_: <T as WriteBinaryDep<HostType>>::Args,
) -> Result<<T as WriteBinaryDep<HostType>>::Output, WriteError>where
C: WriteContext,
fn write_dep<C>(
ctxt: &mut C,
val: HostType,
_: <T as WriteBinaryDep<HostType>>::Args,
) -> Result<<T as WriteBinaryDep<HostType>>::Output, WriteError>where
C: WriteContext,
Write the binary representation of Self to
ctxt.