read_fonts/model/glyph/outline/
type1.rs1use super::{DrawOptions, DrawnMetrics, PathSink};
6use crate::model::Error;
7use crate::{
8 ps::type1::{Type1Font, Type1Instance},
9 types::GlyphId,
10};
11
12#[derive(Clone, Copy)]
14pub struct Type1Glyph<'a> {
15 pub(super) font: Type1Instance<'a>,
17 pub(super) glyph: GlyphId,
18}
19
20impl<'a> Type1Glyph<'a> {
21 pub fn glyph(&self) -> GlyphId {
23 self.glyph
24 }
25
26 pub fn type1_font(&self) -> &'a Type1Font {
28 self.font.font()
29 }
30
31 pub(super) fn draw(
32 &self,
33 options: &DrawOptions,
34 mut sink: &mut dyn PathSink,
35 ) -> Result<DrawnMetrics, Error> {
36 let h_advance = self.font.draw(self.glyph, options.ppem, &mut sink)?;
37 Ok(DrawnMetrics {
38 h_advance,
39 ..Default::default()
40 })
41 }
42}