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

Fix color #68

Merged
merged 5 commits into from
Sep 20, 2024
Merged

Fix color #68

merged 5 commits into from
Sep 20, 2024

Conversation

yutannihilation
Copy link
Owner

A follow up to support COLRv1.

# 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 <- string2path("🌶", ttf)
ggplot(d) +
  geom_path(aes(x, y, group = path_id, color = color)) +
  coord_equal() +
  theme_minimal() +
  scale_color_identity()

d <- string2stroke("🌶", ttf)
ggplot(d) +
  geom_polygon(aes(x, y, group = triangle_id, fill = color)) +
  coord_equal() +
  theme_minimal() +
  scale_fill_identity()

d <- string2fill("🌶", ttf)
ggplot(d) +
  geom_polygon(aes(x, y, group = triangle_id, fill = color)) +
  coord_equal() +
  theme_minimal() +
  scale_fill_identity()

plot
plot
plot

>,
// one layer has only one color
pub layer_color: HashMap<usize, RgbaColor>,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: since paint() is invoked AFTER outline_glyph(), it cannot be treated as an attribute of lyon::path::Path::builder_with_attributes(). Record the color of the layer here and use it afterwards.

@yutannihilation yutannihilation merged commit d3f23bf into main Sep 20, 2024
@yutannihilation yutannihilation deleted the fix-color branch September 20, 2024 03:07
@yutannihilation
Copy link
Owner Author

plot

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.

1 participant