drawing_impeller 1002.0.1

Impeller backend for 2D graphics library
Documentation
pub struct Paragraph {
    pub(crate) paragraph: impellers::Paragraph,
}

impl drawing_api::Paragraph for Paragraph {
    type GlyphInfo = crate::GlyphInfo;

    type LineMetrics = crate::LineMetrics;

    fn get_max_width(&self) -> f32 {
        self.paragraph.get_max_width()
    }

    fn get_height(&self) -> f32 {
        self.paragraph.get_height()
    }

    fn get_longest_line_width(&self) -> f32 {
        self.paragraph.get_longest_line_width()
    }

    fn get_min_intrinsic_width(&self) -> f32 {
        self.paragraph.get_min_intrinsic_width()
    }

    fn get_max_intrinsic_width(&self) -> f32 {
        self.paragraph.get_min_intrinsic_width()
    }

    fn get_ideographic_baseline(&self) -> f32 {
        self.paragraph.get_ideographic_baseline()
    }

    fn get_alphabetic_baseline(&self) -> f32 {
        self.paragraph.get_alphabetic_baseline()
    }

    fn get_line_count(&self) -> u32 {
        self.paragraph.get_line_count()
    }

    fn get_line_metrics(&self) -> Option<Self::LineMetrics> {
        self.paragraph
            .get_line_metrics()
            .map(|l| crate::LineMetrics { line_metrics: l })
    }

    fn get_word_boundary_utf16(&self, code_unit_index: usize) -> drawing_api::Range {
        let range = self.paragraph.get_word_boundary_utf16(code_unit_index);
        drawing_api::Range {
            start: range.start as usize,
            end: range.end as usize,
        }
    }

    fn create_glyph_info_at_code_unit_index_utf16(
        &self,
        code_unit_index: usize,
    ) -> Option<Self::GlyphInfo> {
        self.paragraph
            .create_glyph_info_at_code_unit_index_utf16(code_unit_index)
            .map(|g| crate::GlyphInfo { glyph_info: g })
    }

    fn create_glyph_info_at_paragraph_coordinates(
        &self,
        x: f64,
        y: f64,
    ) -> Option<Self::GlyphInfo> {
        self.paragraph
            .create_glyph_info_at_paragraph_coordinates(x, y)
            .map(|g| crate::GlyphInfo { glyph_info: g })
    }
}