pub struct Math<'a> { /* private fields */ }Expand description
The MATH table
Implementations§
Source§impl<'a> Math<'a>
impl<'a> Math<'a>
pub const MIN_SIZE: usize
Sourcepub fn resolve_offset<O: Offset, R: FontRead<'a, Args = ()>>(
&self,
offset: O,
) -> Result<R, ReadError>
pub fn resolve_offset<O: Offset, R: FontRead<'a, Args = ()>>( &self, offset: O, ) -> Result<R, ReadError>
Resolve the provided offset from the start of this table.
Sourcepub fn offset_data(&self) -> FontData<'a>
pub fn offset_data(&self) -> FontData<'a>
Return a reference to this table’s raw data.
We use this in the compile crate to resolve offsets.
Sourcepub fn shape(&self) -> &Self
👎Deprecated: just use the base type directly
pub fn shape(&self) -> &Self
just use the base type directly
Return a reference to the table’s ‘Shape’ struct.
This is a low level implementation detail, but it can be useful in some cases where you want to know things about a table’s layout, such as the byte offsets of specific fields.
Sourcepub fn version(&self) -> MajorMinor
pub fn version(&self) -> MajorMinor
(major, minor) Version for the MATH table (1,0)
Sourcepub fn math_constants_offset(&self) -> Offset16
pub fn math_constants_offset(&self) -> Offset16
Offset to MathConstants table, from beginning of MATH table.
Sourcepub fn math_constants(&self) -> Result<MathConstants<'a>, ReadError>
pub fn math_constants(&self) -> Result<MathConstants<'a>, ReadError>
Attempt to resolve math_constants_offset.
Sourcepub fn math_glyph_info_offset(&self) -> Offset16
pub fn math_glyph_info_offset(&self) -> Offset16
Offset to MathGlyphInfo table, from beginning of MATH table.
Sourcepub fn math_glyph_info(&self) -> Result<MathGlyphInfo<'a>, ReadError>
pub fn math_glyph_info(&self) -> Result<MathGlyphInfo<'a>, ReadError>
Attempt to resolve math_glyph_info_offset.
Sourcepub fn math_variants_offset(&self) -> Offset16
pub fn math_variants_offset(&self) -> Offset16
Offset to MathVariants table, from beginning of MATH table.
Sourcepub fn math_variants(&self) -> Result<MathVariants<'a>, ReadError>
pub fn math_variants(&self) -> Result<MathVariants<'a>, ReadError>
Attempt to resolve math_variants_offset.
pub fn version_byte_range(&self) -> Range<usize> ⓘ
pub fn math_constants_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn math_glyph_info_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn math_variants_offset_byte_range(&self) -> Range<usize> ⓘ
Source§impl Math<'_>
impl Math<'_>
Sourcepub fn has_swapped_min_heights(&self) -> bool
pub fn has_swapped_min_heights(&self) -> bool
Whether this is one of the Cambria Math builds that stores
delimitedSubFormulaMinHeight and displayOperatorMinHeight the wrong
way round.
A display mode n-ary operator should have the taller of the two thresholds, and in these builds it does not. Microsoft’s implementation reads them the other way round, so anything that wants to lay out maths the way Word does has to swap them back; HarfBuzz does the same. This only reports the font, and leaves that decision to the caller, so that the constants keep saying what the font says.
The font is recognized by its table length together with the two
values, since either value alone is one a font could legitimately hold.
That means it only answers true for a table read as a table: a
Math read from a buffer with anything after it measures longer and
is not recognized.
See harfbuzz#4653.