read_fonts/tables/
vvar.rs

1//! The [VVAR (Vertical Metrics Variation)](https://docs.microsoft.com/en-us/typography/opentype/spec/vvar) table
2
3use super::variations::{self, DeltaSetIndexMap, ItemVariationStore};
4
5include!("../../generated/generated_vvar.rs");
6
7impl Vvar<'_> {
8    /// Returns the advance height delta for the specified glyph identifier and
9    /// normalized variation coordinates.
10    pub fn advance_height_delta(
11        &self,
12        glyph_id: GlyphId,
13        coords: &[F2Dot14],
14    ) -> Result<Fixed, ReadError> {
15        variations::advance_delta(
16            self.advance_height_mapping(),
17            self.item_variation_store(),
18            glyph_id,
19            coords,
20        )
21    }
22
23    /// Returns the top side bearing delta for the specified glyph identifier and
24    /// normalized variation coordinates.
25    pub fn tsb_delta(&self, glyph_id: GlyphId, coords: &[F2Dot14]) -> Result<Fixed, ReadError> {
26        variations::item_delta(
27            self.tsb_mapping(),
28            self.item_variation_store(),
29            glyph_id,
30            coords,
31        )
32    }
33
34    /// Returns the bottom side bearing delta for the specified glyph identifier and
35    /// normalized variation coordinates.
36    pub fn bsb_delta(&self, glyph_id: GlyphId, coords: &[F2Dot14]) -> Result<Fixed, ReadError> {
37        variations::item_delta(
38            self.bsb_mapping(),
39            self.item_variation_store(),
40            glyph_id,
41            coords,
42        )
43    }
44
45    /// Returns the vertical origin delta for the specified glyph identifier and
46    /// normalized variation coordinates.
47    pub fn v_org_delta(&self, glyph_id: GlyphId, coords: &[F2Dot14]) -> Result<Fixed, ReadError> {
48        variations::item_delta(
49            self.v_org_mapping(),
50            self.item_variation_store(),
51            glyph_id,
52            coords,
53        )
54    }
55}