Struct allsorts_no_std::tables::glyf::GlyfTable[][src]

pub struct GlyfTable<'a> {
    pub records: Vec<GlyfRecord<'a>>,
}

Fields

records: Vec<GlyfRecord<'a>>

Implementations

impl<'a> GlyfTable<'a>[src]

pub fn subset(
    &self,
    glyph_ids: &[u16]
) -> Result<(GlyfTable<'a>, Vec<u16>), ParseError>
[src]

Returns a copy of this table that only contains the glyphs specified by glyph_ids.

Trait Implementations

impl<'a> Debug for GlyfTable<'a>[src]

impl<'a> PartialEq<GlyfTable<'a>> for GlyfTable<'a>[src]

impl<'a> ReadBinaryDep<'a> for GlyfTable<'a>[src]

type Args = &'a LocaTable<'a>

type HostType = Self

impl<'a> StructuralPartialEq for GlyfTable<'a>[src]

impl<'a> WriteBinaryDep<GlyfTable<'a>> for GlyfTable<'a>[src]

type Output = LocaTable

The type of the value returned by write_dep.

type Args = IndexToLocFormat

The type of the arguments supplied to write_dep.

fn write_dep<C: WriteContext>(
    ctxt: &mut C,
    table: GlyfTable<'a>,
    index_to_loc_format: IndexToLocFormat
) -> Result<Self::Output, WriteError>
[src]

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.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.