Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support COLRv1 emoji font #65

Merged
merged 3 commits into from
Sep 19, 2024
Merged

Support COLRv1 emoji font #65

merged 3 commits into from
Sep 19, 2024

Conversation

yutannihilation
Copy link
Owner

Close #64

Caveats

This support is not complete.

  • The color information is not included. While it's probably not so difficult, it's not very obvious what format is the best.
  • The clip information and layer information are just discarded. While these might be useful, it's probably not easy to plot them.
library(ggplot2)

devtools::load_all("~/repo/string2path/")

# Note: it seems Noto Color Emoji has many variants. Only that of COLRv1 format
# is supported, so this might not work on installed font of Noto Color Emoji.
ttf <- "~/Downloads/NotoColorEmoji-Regular.ttf"

d <-
  string2fill("🌶", ttf, tolerance = 1e-4) |>
  tibble::rowid_to_column()

ggplot(d) +
  geom_polygon(aes(x, y, group = path_id, fill = factor(path_id)), colour = "green", alpha = 0.7) +
  coord_equal() +
  theme_minimal() +
  theme(legend.position = "none") +
  scale_fill_viridis_d(option = "F")

image

@yutannihilation yutannihilation merged commit f894886 into main Sep 19, 2024
3 checks passed
@yutannihilation yutannihilation deleted the colr-v1 branch September 19, 2024 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support COLRv1 emoji fonts
1 participant