pub trait PlatformTextSystem: Send + Sync {
    // Required methods
    fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> Result<()>;
    fn all_font_families(&self) -> Vec<String>;
    fn font_id(&self, descriptor: &Font) -> Result<FontId>;
    fn font_metrics(&self, font_id: FontId) -> FontMetrics;
    fn typographic_bounds(
        &self,
        font_id: FontId,
        glyph_id: GlyphId
    ) -> Result<Bounds<f32>>;
    fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>>;
    fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId>;
    fn glyph_raster_bounds(
        &self,
        params: &RenderGlyphParams
    ) -> Result<Bounds<DevicePixels>>;
    fn rasterize_glyph(
        &self,
        params: &RenderGlyphParams,
        raster_bounds: Bounds<DevicePixels>
    ) -> Result<(Size<DevicePixels>, Vec<u8>)>;
    fn layout_line(
        &self,
        text: &str,
        font_size: Pixels,
        runs: &[FontRun]
    ) -> LineLayout;
    fn wrap_line(
        &self,
        text: &str,
        font_id: FontId,
        font_size: Pixels,
        width: Pixels
    ) -> Vec<usize>;
}

Required Methods§

source

fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> Result<()>

source

fn all_font_families(&self) -> Vec<String>

source

fn font_id(&self, descriptor: &Font) -> Result<FontId>

source

fn font_metrics(&self, font_id: FontId) -> FontMetrics

source

fn typographic_bounds( &self, font_id: FontId, glyph_id: GlyphId ) -> Result<Bounds<f32>>

source

fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>>

source

fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId>

source

fn glyph_raster_bounds( &self, params: &RenderGlyphParams ) -> Result<Bounds<DevicePixels>>

source

fn rasterize_glyph( &self, params: &RenderGlyphParams, raster_bounds: Bounds<DevicePixels> ) -> Result<(Size<DevicePixels>, Vec<u8>)>

source

fn layout_line( &self, text: &str, font_size: Pixels, runs: &[FontRun] ) -> LineLayout

source

fn wrap_line( &self, text: &str, font_id: FontId, font_size: Pixels, width: Pixels ) -> Vec<usize>

Implementors§