Skip to main content

Base14Metrics

Struct Base14Metrics 

Source
pub struct Base14Metrics;

Trait Implementations§

Source§

impl FontMetrics for Base14Metrics

Source§

fn advance(&self, font: FontKey, c: char, size: Length) -> Option<Length>

Horizontal advance of c at size, or None if the font has no glyph for it.
Source§

fn ascender(&self, _font: FontKey, size: Length) -> Length

Height above the baseline at size.
Source§

fn descender(&self, _font: FontKey, size: Length) -> Length

Depth below the baseline at size (a positive value).
Source§

fn glyph_vextent( &self, _font: FontKey, _c: char, _size: Length, ) -> Option<(Length, Length)>

One glyph’s vertical extent from its ACTUAL bounding box — (height above baseline = ymax, depth below baseline = -ymin), both in size units. None when the provider has no per-glyph bbox (base-14 / test stubs), in which case run_vextent falls back to ascender/descender. This is how SATySFi measures glyphs (fontFormat.ml’s get_glyph_metrics: hgt = ymax, dpt = ymin).
Source§

fn run_vextent( &self, font: FontKey, text: &str, size: Length, ) -> (Length, Length)

A text run’s (height, depth) the way SATySFi’s get_metrics_of_word (fontInfo.ml:192) computes it: the MAX glyph ymax and MAX -ymin over the run’s actual glyph bounding boxes — NOT the font-level ascender/descender. Starting the folds at zero clamps a run with no descenders (Japanese, digits, TOC leader dots) to depth 0, matching SATySFi’s much tighter inter-line advance for such content. Falls back to ascender/descender when no glyph exposes a bbox.
Source§

fn text_width(&self, font: FontKey, text: &str, size: Length) -> Option<Length>

Source§

fn math_constants(&self, _font: FontKey) -> Option<MathConstants>

The font’s OpenType MATH MathConstants table, or None when the font has no MATH table (every base-14/non-math provider). Lang-side math layout (MathC resolver) falls back to the pre-MATH-table fixed constants whenever this is None, so a provider that never overrides it (like Base14Metrics) keeps today’s fixtures byte-identical.
Source§

fn italic_correction( &self, _font: FontKey, _c: char, _size: Length, ) -> Option<Length>

The italic correction of c at size (OpenType MATH MathItalicsCorrectionInfo), or None when the font has no MATH table or no entry for this glyph.
Source§

fn math_kern( &self, _font: FontKey, _c: char, _size: Length, _corner: MathCorner, _corr: Length, ) -> Option<Length>

The OpenType MATH per-glyph corner kern of c at size, sampled at correction height corr (MathKernInfo/MathKern), or None when the font has no MATH table or no kern data for this glyph/corner.
Source§

fn math_vertical_variant( &self, _font: FontKey, _c: char, _size: Length, _policy: VertVariantPolicy, ) -> Option<MathVariantGlyph>

A vertically-grown MATH variant of c at size, selected per policy (OpenType MATH MathVariants, — big operators/stretchy delimiters). None when the font has no MATH table, no vertical construction for c, or the construction has no prepared variant records (assembly-only); every caller must treat None as “use the base glyph unchanged” (push_char_glyph), so a provider that never overrides this (every base-14 provider) leaves every fixture that predates vertical MATH-variant support byte-identical.
Source§

fn math_script_variant( &self, _font: FontKey, _c: char, _size: Length, ) -> Option<MathVariantGlyph>

The ssty (Math Script Style) GSUB variant of c at size — upstream FontFormat.get_math_script_variant (fontFormat.ml:2216), applied by fontInfo.ml:379-383 to every math glyph below base level. These are purpose-drawn exponent/index forms with their OWN advances, not the base glyph scaled (Latin Modern Math’s two.st advances 569/1000 em against plain two’s 500), so this is a width contract as much as a shape one. Read more
Source§

fn math_vertical_assembly( &self, _font: FontKey, _c: char, _size: Length, _target: Length, ) -> Option<Vec<(u16, Length, Length)>>

Build a vertically-stretched delimiter/big-op from the OpenType MATH GlyphAssembly of c (the stretch-beyond-the-largest-discrete-variant path). Returns the placed parts as (gid, dy, advance), bottom-to-top, where dy is the y-up, box-local vertical offset of the part’s own baseline (the bottom part sits at dy = 0, each subsequent part is raised by the previous part’s advance minus their connector overlap), and advance is the part glyph’s design-unit full_advance scaled to size (the vertical extent it contributes). The parts stack with overlaps >= min_connector_overlap, repeating extender parts as many times as needed to reach target. None when the font has no MATH table, no vertical construction for c, or that construction has no GlyphAssembly — every caller must treat None as “fall back to the largest discrete variant” (push_delimiter_glyph), so a provider that never overrides this (every base-14 provider) is unaffected.
Source§

fn resolve_font_abbrev(&self, _abbrev: &str) -> Option<FontKey>

Resolve a registry abbrev ("ipaexm", "Junicode-b", …) to its FontKey. None means either “no such abbrev in this provider’s registry” or “this provider has no registry at all” (every provider that predates the registry, Base14Metrics) — the caller then falls back to the milestone-1 3-face name heuristic (resolve_font_abbrev free fn, rustyfi-lang), keeping every existing set-font call byte-identical.
Source§

fn font_abbrev(&self, _key: FontKey) -> Option<String>

The inverse of FontMetrics::resolve_font_abbrev: which registry abbrev minted key. This exists for 0.0.6’s get-font, whose result type tFONT = string * float * float leads with an ABBREV — upstream keeps the abbrev in context_main.font_scheme and only resolves it to a file at render time, whereas this port resolves eagerly at set-font and stores a FontKey, so the name has to be recovered from whoever minted the key. Read more
Source§

fn default_script_font(&self, _script: Script) -> Option<(FontKey, f64, f64)>

The configured default (font, ratio, rising) for script, from default-font.satysfi-hash’s scripts block. None means “no scheme configured for this script” — the caller then falls back to (ctx.font, 1.0, 0.0), i.e. today’s single-font behavior.
Source§

fn default_math_font(&self) -> Option<FontKey>

The configured default math font, from default-font.satysfi-hash’s optional "math" abbrev. None means “no math default configured” — the caller (get-initial-context) then leaves Context::math_font at its Context::initial seed (FontKey(0), the regular text face), i.e. today’s behavior. Every provider that predates this math-default support (Base14Metrics, a bare TtfFontStore::load, a registry with no "math" entry) returns None here, so this is purely additive.

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> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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.