Render emojis

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-04-13 17:31:10 +02:00
parent fff1d9c631
commit cdcdccfb89
7 changed files with 255 additions and 56 deletions

View file

@ -129,6 +129,12 @@ pub enum CursorStyle {
PointingHand,
}
#[derive(Copy, Clone, Debug)]
pub enum RasterizationOptions {
Alpha,
Bgra,
}
pub trait FontSystem: Send + Sync {
fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> anyhow::Result<()>;
fn load_family(&self, name: &str) -> anyhow::Result<Vec<FontId>>;
@ -148,6 +154,7 @@ pub trait FontSystem: Send + Sync {
glyph_id: GlyphId,
subpixel_shift: Vector2F,
scale_factor: f32,
options: RasterizationOptions,
) -> Option<(RectI, Vec<u8>)>;
fn layout_line(&self, text: &str, font_size: f32, runs: &[(usize, RunStyle)]) -> LineLayout;
fn wrap_line(&self, text: &str, font_id: FontId, font_size: f32, width: f32) -> Vec<usize>;