Enum truetype::maximum_profile::MaximumProfile
source · pub enum MaximumProfile {
Version0(MaximumProfile0),
Version1(MaximumProfile1),
}
Expand description
A maximum profile.
Variants§
Implementations§
source§impl MaximumProfile
impl MaximumProfile
sourcepub fn glyph_count(&self) -> usize
pub fn glyph_count(&self) -> usize
Return the number of glyphs.
Examples found in repository?
More examples
src/horizontal_metrics.rs (line 60)
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
fn read<T: Tape>(tape: &mut T, (header, profile): Self::Parameter) -> Result<Self> {
let metric_count = header.horizontal_metric_count as usize;
let glyph_count = profile.glyph_count();
if metric_count == 0 || metric_count > glyph_count {
raise!("found a malformed horizontal header");
}
let bearing_count = glyph_count - metric_count;
let mut table = HorizontalMetrics {
records: Vec::with_capacity(metric_count),
left_side_bearings: Vec::with_capacity(bearing_count),
};
for _ in 0..metric_count {
table.records.push(tape.take()?);
}
for _ in 0..bearing_count {
table.left_side_bearings.push(tape.take()?);
}
Ok(table)
}
Trait Implementations§
source§impl Clone for MaximumProfile
impl Clone for MaximumProfile
source§fn clone(&self) -> MaximumProfile
fn clone(&self) -> MaximumProfile
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more