Skip to content

Commit

Permalink
Add best-effort support for COLRv1.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed May 13, 2024
1 parent 4daa53a commit 4b4e897
Show file tree
Hide file tree
Showing 12 changed files with 450 additions and 93 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
10 changes: 9 additions & 1 deletion crates/resvg/tests/fonts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ Twitter Color Emoji

Noto Color Emoji (CBDT)
1. Download: https://github.com/googlefonts/noto-emoji/blob/main/fonts/NotoColorEmoji.ttf
2. Run `fonttools subset NotoColorEmoji.ttf --unicodes="U+1F600" --output-file=NotoColorEmojiCBDT.subset.ttf`
2. Run `fonttools subset NotoColorEmoji.ttf --unicodes="U+1F600" --output-file=NotoColorEmojiCBDT.subset.ttf`

Noto COLOR Emoji (COLRv1)
1. Download: https://fonts.google.com/noto/specimen/Noto+Color+Emoji
2. Run `fonttools subset NotoColorEmoji-Regular.ttf --unicodes="U+1F436,U+1F41D,U+1F313,U+1F973" --output-file=NotoColorEmojiCOLR.subset.ttf`
3. Run `fonttools ttx NotoColorEmojiCOLR.subset.ttf`
4. Go to the <name> section and rename all instances of "Noto Color Emoji" to "Noto Color Emoji COLR" (so that
we can distinguish them from CBDT in tests).
5. Run `fonttools ttx -f NotoColorEmojiCOLR.subset.ttx`
1 change: 1 addition & 0 deletions crates/resvg/tests/integration/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,7 @@ use crate::render;
#[test] fn text_baseline_shift_with_rotate() { assert_eq!(render("tests/text/baseline-shift/with-rotate"), 0); }
#[test] fn text_color_font_cbdt() { assert_eq!(render("tests/text/color-font/cbdt"), 0); }
#[test] fn text_color_font_colrv0() { assert_eq!(render("tests/text/color-font/colrv0"), 0); }
#[test] fn text_color_font_colrv1() { assert_eq!(render("tests/text/color-font/colrv1"), 0); }
#[test] fn text_color_font_compound_emojis_and_coordinates_list() { assert_eq!(render("tests/text/color-font/compound-emojis-and-coordinates-list"), 0); }
#[test] fn text_color_font_compound_emojis() { assert_eq!(render("tests/text/color-font/compound-emojis"), 0); }
#[test] fn text_color_font_mixed_text_rtl() { assert_eq!(render("tests/text/color-font/mixed-text-rtl"), 0); }
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions crates/resvg/tests/tests/text/color-font/colrv1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions crates/usvg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ simplecss = "0.2"
siphasher = "1.0" # perfect hash implementation

# text
fontdb = { version = "0.16.1", default-features = false, optional = true }
rustybuzz = { version = "0.13", optional = true }
fontdb = { version = "0.17.0", default-features = false, optional = true }
rustybuzz = { version = "0.14.0", optional = true }
unicode-bidi = { version = "0.3", optional = true }
unicode-script = { version = "0.5", optional = true }
unicode-vo = { version = "0.1", optional = true }
Expand Down
Loading

0 comments on commit 4b4e897

Please sign in to comment.