1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Glyph positioning table.
use crate::otl::*;
use crate::parse_prelude::*;
/// Tag for the `GPOS` table.
pub const GPOS: Tag = Tag::new(b"GPOS");
/// Glyph positioning table.
///
/// <https://docs.microsoft.com/en-us/typography/opentype/spec/gpos>
#[derive(Copy, Clone)]
pub struct Gpos<'a>(pub Layout<'a>);
impl<'a> Gpos<'a> {
/// Creates a new glyph positioning table from a byte slice containing
/// the table data and an optional glyph definition table.
pub fn new(data: &'a [u8], gdef: Option<Gdef<'a>>) -> Self {
Self(Layout::new(Stage::PositionAdjustment, data, gdef))
}
/// Returns the associated glyph definitions.
pub fn gdef(&self) -> Option<&Gdef<'a>> {
self.0.gdef()
}
/// Returns the number of available scripts.
pub fn num_scripts(&self) -> u16 {
self.0.num_scripts()
}
/// Returns the script at the specified index.
pub fn script(&'a self, index: u16) -> Option<Script<'a>> {
self.0.script(index)
}
/// Returns an iterator over the available scripts.
pub fn scripts(&'a self) -> impl Iterator<Item = Script<'a>> + 'a + Clone {
self.0.scripts()
}
/// Returns the number of available features.
pub fn num_features(&self) -> u16 {
self.0.num_features()
}
/// Returns the feature at the specified index.
pub fn feature(&'a self, index: u16) -> Option<Feature<'a>> {
self.0.feature(index)
}
/// Returns an iterator over the available features.
pub fn features(&'a self) -> impl Iterator<Item = Feature<'a>> + 'a + Clone {
self.0.features()
}
/// Returns feature variation support for the layout table.
pub fn feature_variations(&'a self) -> Option<FeatureVariations<'a>> {
self.0.feature_variations()
}
/// Returns the number of available lookups.
pub fn num_lookups(&self) -> u16 {
self.0.num_lookups()
}
/// Returns the lookup at the specified index.
pub fn lookup(&'a self, index: u16) -> Option<Lookup<'a>> {
self.0.lookup(index)
}
/// Returns an iterator over the available lookups.
pub fn lookups(&'a self) -> impl Iterator<Item = Lookup<'a>> + 'a + Clone {
self.0.lookups()
}
}