Skip to main content

TrueTypeHinter

Struct TrueTypeHinter 

Source
pub(super) struct TrueTypeHinter {
    instance: HintInstance,
    tables: Option<Yoke<HintTables<'static>, Arc<Tables>>>,
    scale: Option<Scale26Dot6>,
    ppem: f32,
    pedantic: bool,
    hdmx_widths: Option<Range<usize>>,
    scratch_lengths: ScratchLengths,
}
Expand description

The interpreter, configured for one font at one size.

Fields§

§instance: HintInstance§tables: Option<Yoke<HintTables<'static>, Arc<Tables>>>

The tables the interpreter reads, parsed once per font and yoked to the tables they borrow.

§scale: Option<Scale26Dot6>§ppem: f32

The interpreter’s size, rounded for a font that requests whole pixel sizes.

§pedantic: bool§hdmx_widths: Option<Range<usize>>

The byte range of the widths in the hdmx record for the size.

§scratch_lengths: ScratchLengths

Implementations§

Source§

impl TrueTypeHinter

Source

pub(super) fn reconfigure( &mut self, font: &Font, ppem: f32, hinting: &HintOptions, ) -> Result<(), ScaleError>

Runs the font and control value programs for font at ppem.

Source

pub(super) fn is_enabled(&self) -> bool

Returns true if glyphs are hinted at this size.

The control value program or the gasp table can disable hinting for a size.

Source

pub(super) fn program_unhinted_ppem(&self) -> Option<f32>

Returns the size for an unhinted draw when the control value program disabled hinting.

This is the interpreter’s size, because FreeType chooses its scale before it reads the program’s flag. Returns None when hinting is on or when the gasp table disabled it. FreeType checks gasp before choosing a scale, so it draws at the requested size.

Source

pub(super) fn ppem(&self) -> Option<f32>

Returns the size the interpreter hints at, once configured.

Source

pub(super) fn raster_policy(&self) -> RasterPolicy

Source

pub(super) fn required_memory_size(&self, outline: &GlyfGlyph<'_>) -> usize

Returns the bytes of working memory needed to draw outline.

This covers the loader’s buffers and the interpreter’s.

Source

pub(super) fn draw( &self, outline: &GlyfGlyph<'_>, memory: Option<&mut [u8]>, sink: &mut dyn PathSink, ) -> Result<DrawnMetrics, ScaleError>

Source

fn draw_in( &self, outline: &GlyfGlyph<'_>, buf: &mut [u8], sink: &mut dyn PathSink, ) -> Result<DrawnMetrics, ScaleError>

Source

fn hdmx_width(&self, tables: &Tables, glyph: GlyphId) -> Option<i32>

Returns the hdmx advance for glyph at the size, if any.

Trait Implementations§

Source§

impl Default for TrueTypeHinter

Source§

fn default() -> TrueTypeHinter

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.