pub struct GlyfTable<'a> {
pub records: Vec<GlyfRecord<'a>>,
}
Expand description
Fields
records: Vec<GlyfRecord<'a>>
Implementations
sourceimpl<'a> GlyfTable<'a>
impl<'a> GlyfTable<'a>
sourcepub fn get_parsed_glyph(
&mut self,
glyph_index: u16
) -> Result<Option<&Glyph<'_>>, ParseError>
pub fn get_parsed_glyph(
&mut self,
glyph_index: u16
) -> Result<Option<&Glyph<'_>>, ParseError>
Returns a parsed glyph if present. Returns None
if the GlyfRecord
is Empty
.
Trait Implementations
sourceimpl<'a> OutlineBuilder for GlyfTable<'a>
impl<'a> OutlineBuilder for GlyfTable<'a>
type Error = ParseError
sourceimpl<'a> ReadBinaryDep<'a> for GlyfTable<'a>
impl<'a> ReadBinaryDep<'a> for GlyfTable<'a>
sourceimpl<'a> WriteBinaryDep<GlyfTable<'a>> for GlyfTable<'a>
impl<'a> WriteBinaryDep<GlyfTable<'a>> for GlyfTable<'a>
sourcefn write_dep<C: WriteContext>(
ctxt: &mut C,
table: GlyfTable<'a>,
index_to_loc_format: IndexToLocFormat
) -> Result<Self::Output, WriteError>
fn write_dep<C: WriteContext>(
ctxt: &mut C,
table: GlyfTable<'a>,
index_to_loc_format: IndexToLocFormat
) -> Result<Self::Output, WriteError>
Write this glyf table into ctxt
.
A Note About Padding
On the loca table documentation at the bottom it states:
Note that the local offsets should be 32-bit aligned. Offsets which are not 32-bit aligned may seriously degrade performance of some processors.
On the Recommendations for OpenType Fonts page it states:
We recommend that local offsets should be 16-bit aligned, in both the short and long formats of this table.
On Apple’s loca documentation it says:
The glyph data is always word aligned.
Elsewhere in the Apple docs they refer to long as 32-bits, so assuming word here means 16-bits.
An issue was raised against Microsoft’s docs regarding this. Behdad Esfahbod commented:
All the requirements should be removed since 2019.
In reality, in the short format, you are forced to do 16-bit alignment because of how offsets are stored. In the long format, use alignment 1. We’ve been doing that in fonttools for years and never ever heard a complaint whatsoever.
So with this in mind we implement 16-bit alignment when index_to_loc_format
is 0,
and no alignment/padding otherwise.
type Args = IndexToLocFormat
type Args = IndexToLocFormat
The type of the arguments supplied to write_dep
.
impl<'a> StructuralPartialEq for GlyfTable<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for GlyfTable<'a>
impl<'a> Send for GlyfTable<'a>
impl<'a> Sync for GlyfTable<'a>
impl<'a> Unpin for GlyfTable<'a>
impl<'a> UnwindSafe for GlyfTable<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more