-
Notifications
You must be signed in to change notification settings - Fork 143
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
Trouble drawing emojis #536
Comments
Okay, I think it has something to do with the color. When I use "NotoColorEmoji-Regular.ttf", which is a font that only has the black outline of each emoji, it renders correctly (the ax emoji and numbers show up). This makes me think that Vello is fine, I just need to figure out how to use the color that the fonts are giving me. I expect that if I dive into the text shaping crates I will figure this out. |
@jasoneveleth There is a little bit more to color emoji support. Supporting the two current main ways that fonts represent color emoji (‘COLRv1’ and embedded PNGs) is something that we intend to do. |
Thank you. That's exactly what I needed to know. |
And specifically COLRv1 (the version of color emoji used in current versions of Noto Color Emoji) is likely to be first. |
We decided in the 2024-04-04 office hours to re-open this issue, and use it track getting COLRv1 emoji (etc.) working in Vello See also #gpu > Emoji Rendering |
I'd like to get Apple's emojis to render on mac. Do they use COLRv1? I would guess from the existence of this python library that they're using pngs. If they're using pngs, is the best strategy to render them as an Image and then |
This is following the breadcrumbs laid out in [#gpu > Emoji Rendering](https://xi.zulipchat.com/#narrow/stream/197075-gpu/topic/Emoji.20rendering) This supports rendering COLR emoji; we assume that these are reasonably well behaved. ![image](https://github.com/linebender/vello/assets/36049421/42c11e1d-ef64-4f4e-bd61-9ee6c09c223c) For examples, we use a very small subset of [Noto Color Emoji](https://fonts.google.com/noto/specimen/Noto+Color+Emoji), which is approximately 5.5kB. Fixes linebender#536 We will need a follow up issue for `sbix`/`CBDT`. I presume we're ignoring svg-in-opentype. --------- Co-authored-by: Chad Brokaw <cbrokaw@gmail.com>
So, #615 supports COLR Emoji, which is not the format used by the Apple emoji. There is still more work required here However, if you can afford to include Noto Colour Emoji in your app as a temporary measure, this should work using latest main. |
And the one exception with Noto Color Emoji is that the flag emoji are in a separate CBDT-based color bitmap font. |
I'm trying to render emojis using
winit
. I've gotten normal text to render just fine following along from here. I'm using an emoji font (I know it has emojis since thecharmap.map(c)
is returning a nonzerogid
, and is returning a zerogid
for normal ascii). The following code I think provides enough context to understand what I'm doing:The
text
has the emojis we're rendering from. In my case I'm using "abc🪓123" which turns into GID_0, GID_0, GID_0, GID_3750, GID_3192, GID_3198, GID_3196, respectively. Thecharmap
holds the charmap from a font_ref from the font. I'm using the NotoColorEmoji-Regular.ttf font. I'm on macOS 14.2.1 on M1 Pro. When it renders I see the box for missing glyphs for abc but just black for the rest.I'm starting to think that I'm doing emojis the wrong way because the object returned by
draw_glyphs
has a brush object that defaults to pure black, but I don't want my emojis to be all black. I've looked around and I can't find anything about how to render an emojis. I'm happy to provide a gist for people in the future trying to do a similar thing.In short, is this something that is possible? And what files/docs should I go find to get the information I need to understand how to render emojis?
Thank you for such a wonderful library.
EDIT: explaining the parts of the code snippet
The text was updated successfully, but these errors were encountered: