Skip to main content

MathParams

Struct MathParams 

Source
pub struct MathParams {
Show 40 fields pub x_height: Dim, pub quad: Dim, pub axis_height: Dim, pub accent_base_height: Dim, pub flattened_accent_base_height: Dim, pub fraction_rule_thickness: Dim, pub fraction_numerator_shift_up: Dim, pub fraction_numerator_display_style_shift_up: Dim, pub fraction_denominator_shift_down: Dim, pub fraction_denominator_display_style_shift_down: Dim, pub fraction_numerator_gap_min: Dim, pub fraction_num_display_style_gap_min: Dim, pub fraction_denominator_gap_min: Dim, pub fraction_denom_display_style_gap_min: Dim, pub superscript_shift_up: Dim, pub superscript_shift_up_cramped: Dim, pub subscript_shift_down: Dim, pub sub_superscript_gap_min: Dim, pub space_after_script: Dim, pub radical_vertical_gap: Dim, pub radical_display_style_vertical_gap: Dim, pub radical_rule_thickness: Dim, pub radical_extra_ascender: Dim, pub radical_kern_before_degree: Dim, pub radical_kern_after_degree: Dim, pub radical_degree_bottom_raise_percent: i16, pub overbar_vertical_gap: Dim, pub overbar_rule_thickness: Dim, pub overbar_extra_ascender: Dim, pub underbar_vertical_gap: Dim, pub underbar_rule_thickness: Dim, pub underbar_extra_descender: Dim, pub upper_limit_gap_min: Dim, pub upper_limit_baseline_rise_min: Dim, pub lower_limit_gap_min: Dim, pub lower_limit_baseline_drop_min: Dim, pub display_operator_min_height: Dim, pub script_percent_scale_down: i16, pub script_script_percent_scale_down: i16, pub units_per_em: u16,
}
Expand description

MATH-table parameters used by the layout engine.

§Examples

use latex_rust::{MathFont, MathParams, MathStyle};

let font = MathFont::stix_two_math().unwrap();
let p = MathParams::from_font(&font).unwrap();
assert!(!p.axis_height.is_zero());
assert!(!p.em(MathStyle::Text).is_zero());

Fields§

§x_height: Dim

σ1: x-height (em).

§quad: Dim

σ2: quad / em width.

§axis_height: Dim

σ6 / σ22: math axis height.

§accent_base_height: Dim

Accent base height.

§flattened_accent_base_height: Dim

Flattened accent base height (cramped / tall bases).

§fraction_rule_thickness: Dim

σ8: default rule thickness (fraction / radical bar).

§fraction_numerator_shift_up: Dim

σ10 analogue: numerator shift (text).

§fraction_numerator_display_style_shift_up: Dim

σ9 analogue: numerator shift (display).

§fraction_denominator_shift_down: Dim

σ12 analogue: denominator shift (text).

§fraction_denominator_display_style_shift_down: Dim

σ11 analogue: denominator shift (display).

§fraction_numerator_gap_min: Dim

Minimum gap num ↔ rule (text).

§fraction_num_display_style_gap_min: Dim

Minimum gap num ↔ rule (display).

§fraction_denominator_gap_min: Dim

Minimum gap rule ↔ den (text).

§fraction_denom_display_style_gap_min: Dim

Minimum gap rule ↔ den (display).

§superscript_shift_up: Dim

σ14 analogue: superscript shift (text).

§superscript_shift_up_cramped: Dim

σ15 analogue: superscript shift cramped.

§subscript_shift_down: Dim

σ16 analogue: subscript shift.

§sub_superscript_gap_min: Dim

Minimum gap between sub and sup.

§space_after_script: Dim

Space after a script.

§radical_vertical_gap: Dim

Radical vertical gap (text).

§radical_display_style_vertical_gap: Dim

Radical vertical gap (display).

§radical_rule_thickness: Dim

Radical rule thickness.

§radical_extra_ascender: Dim

Extra ascender above radical rule.

§radical_kern_before_degree: Dim

Kern before a radical degree.

§radical_kern_after_degree: Dim

Kern after a radical degree.

§radical_degree_bottom_raise_percent: i16

Degree bottom raise percent (integer 0–100).

§overbar_vertical_gap: Dim

Overbar gap.

§overbar_rule_thickness: Dim

Overbar rule thickness.

§overbar_extra_ascender: Dim

Overbar extra ascender.

§underbar_vertical_gap: Dim

Underbar gap.

§underbar_rule_thickness: Dim

Underbar rule thickness.

§underbar_extra_descender: Dim

Underbar extra descender.

§upper_limit_gap_min: Dim

Upper limit gap min.

§upper_limit_baseline_rise_min: Dim

Upper limit baseline rise min.

§lower_limit_gap_min: Dim

Lower limit gap min.

§lower_limit_baseline_drop_min: Dim

Lower limit baseline drop min.

§display_operator_min_height: Dim

Display operator min height (font units, as Dim em).

§script_percent_scale_down: i16

Script scale (percent, e.g. 70).

§script_script_percent_scale_down: i16

Scriptscript scale (percent, e.g. 55).

§units_per_em: u16

unitsPerEm.

Implementations§

Source§

impl MathParams

Source

pub fn from_font(font: &MathFont) -> Result<Self, Error>

Load MATH constants from font. Missing MATH is Error::Unsupported.

§Errors

Error::Unsupported if the face has no MATH table or constants.

Source

pub fn scale(&self, style: MathStyle) -> Dim

Scale factor for style (1, script%, or scriptscript%).

Source

pub fn em(&self, style: MathStyle) -> Dim

Current em (quad * scale).

Source

pub fn mu(&self, style: MathStyle) -> Dim

One mu at style (em / 18).

Trait Implementations§

Source§

impl Clone for MathParams

Source§

fn clone(&self) -> MathParams

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MathParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.