pub trait IGlyphProvider {
// Required methods
fn ligature_glyph(&self, font: &Font, id: GlyphId) -> Option<ImmutStr>;
fn svg_glyph(&self, font: &Font, id: GlyphId) -> Option<Arc<[u8]>>;
fn bitmap_glyph(
&self,
font: &Font,
id: GlyphId,
ppem: u16,
) -> Option<(TypstImage, i16, i16)>;
fn outline_glyph(&self, font: &Font, id: GlyphId) -> Option<String>;
}Expand description
IGlyphProvider extracts the font data from the font.
Note (Possibly block unsafe): If a Font is dummy (lazy loaded),
it will block current thread and fetch the font data from the server.
Required Methods§
Sourcefn ligature_glyph(&self, font: &Font, id: GlyphId) -> Option<ImmutStr>
fn ligature_glyph(&self, font: &Font, id: GlyphId) -> Option<ImmutStr>
With font with glyph id, return the raw ligature string.
See FontGlyphProvider::ligature_glyph for the default
implementation.
Sourcefn svg_glyph(&self, font: &Font, id: GlyphId) -> Option<Arc<[u8]>>
fn svg_glyph(&self, font: &Font, id: GlyphId) -> Option<Arc<[u8]>>
With font with glyph id, return the svg document data.
Note: The returned data is possibly compressed.
See FontGlyphProvider::svg_glyph for the default implementation.
Sourcefn bitmap_glyph(
&self,
font: &Font,
id: GlyphId,
ppem: u16,
) -> Option<(TypstImage, i16, i16)>
fn bitmap_glyph( &self, font: &Font, id: GlyphId, ppem: u16, ) -> Option<(TypstImage, i16, i16)>
With font with glyph id, return the bitmap image data.
Optionally, with given ppem, return the best fit bitmap image.
Return the best quality bitmap image if ppem is std::u16::MAX.
See FontGlyphProvider::bitmap_glyph for the default implementation.
Sourcefn outline_glyph(&self, font: &Font, id: GlyphId) -> Option<String>
fn outline_glyph(&self, font: &Font, id: GlyphId) -> Option<String>
With font with glyph id, return the outline path data.
The returned data is in Path2D format.
See FontGlyphProvider::outline_glyph for the default implementation.