Skip to content

Commit

Permalink
Finish CBDT support
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Aug 30, 2024
1 parent 7462c22 commit 8c0afbc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
Binary file added assets/refs/noto_color_emoji_cbdt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
5 changes: 2 additions & 3 deletions src/font/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ use crate::error::{KrillaError, KrillaResult};
use crate::font::Font;
use crate::object::image::Image;
use crate::surface::Surface;
use skrifa::raw::TableProvider;
use skrifa::{GlyphId, MetadataProvider, Tag};
use tiny_skia_path::{Size, Transform};
use skrifa::{GlyphId, MetadataProvider};
use tiny_skia_path::Transform;
use crate::font::bitmap::utils::{BitmapData, BitmapFormat, BitmapStrikes, Origin};

/// Draw a bitmap-based glyph on a surface.
Expand Down
2 changes: 2 additions & 0 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ lazy_font!(COLR_TEST_GLYPHS, FONT_PATH.join("colr_test_glyphs.ttf"));
#[rustfmt::skip]
lazy_font!(NOTO_COLOR_EMOJI_COLR, FONT_PATH.join("NotoColorEmoji.COLR.subset.ttf"));
#[rustfmt::skip]
lazy_font!(NOTO_COLOR_EMOJI_CBDT, FONT_PATH.join("NotoColorEmoji.CBDT.subset.ttf"));
#[rustfmt::skip]
lazy_font!(TWITTER_COLOR_EMOJI, FONT_PATH.join("TwitterColorEmoji.subset.ttf"));

pub fn rect_to_path(x1: f32, y1: f32, x2: f32, y2: f32) -> Path {
Expand Down
9 changes: 7 additions & 2 deletions src/tests/visreg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::rgb::Rgb;
use crate::stream::Glyph;
use crate::surface::Surface;
use crate::tests::manual::all_glyphs_to_pdf;
use crate::tests::{COLR_TEST_GLYPHS, NOTO_COLOR_EMOJI_COLR, NOTO_SANS, TWITTER_COLOR_EMOJI};
use crate::tests::{COLR_TEST_GLYPHS, NOTO_COLOR_EMOJI_CBDT, NOTO_COLOR_EMOJI_COLR, NOTO_SANS, TWITTER_COLOR_EMOJI};
use crate::util::SliceExt;
use crate::{rgb, Fill, LinearGradient, Paint, SpreadMethod, Stop};
use cosmic_text::{Attrs, Buffer, FontSystem, Metrics, Shaping};
Expand Down Expand Up @@ -120,10 +120,15 @@ fn colr_test_glyphs(document: &mut Document) {
}

#[visreg(document)]
fn noto_color_emoji(document: &mut Document) {
fn noto_color_emoji_colr(document: &mut Document) {
let font_data = NOTO_COLOR_EMOJI_COLR.clone();
all_glyphs_to_pdf(font_data, None, document);
}
#[visreg(document)]
fn noto_color_emoji_cbdt(document: &mut Document) {
let font_data = NOTO_COLOR_EMOJI_CBDT.clone();
all_glyphs_to_pdf(font_data, None, document);
}

#[visreg(document)]
#[cfg(target_os = "macos")]
Expand Down

0 comments on commit 8c0afbc

Please sign in to comment.