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

Colour emoji #267

Closed
jack9267 opened this issue Jan 15, 2022 · 3 comments
Closed

Colour emoji #267

jack9267 opened this issue Jan 15, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@jack9267
Copy link

I noticed there isn't any support for colour emoji in the default font engine. In the case of freetype it'll do the work for us, we simply need to give the flag FT_LOAD_COLOR to FT_Load_Glyph and handle FT_PIXEL_MODE_BGRA. Although the FontGlyph class likely needs adjustments to accommodate the added red, green and blue. Also need to not apply any colour tinting if it's colour emoji.

@mikke89
Copy link
Owner

mikke89 commented Jan 15, 2022

You're right, I'd happily take a PR for this!

@mikke89 mikke89 added the enhancement New feature or request label Jan 15, 2022
@mikke89
Copy link
Owner

mikke89 commented Jan 25, 2022

I went ahead and got busy with this. The result has been merged in: 25ceb70.

So, color emojis are now working! 🙌

I have tested the implementation with four different fonts, Windows' builtin Segoe, Joypixels, Noto, and Firefox. We don't include them with our samples because they are big and some of them don't have a proper license.

By the way, some color fonts, including Segoe, require FreeType 2.10+ to be shown with full colors. I also made sure that it works with font-effects. The only exception is the shadow effect which is ignored on color glyphs. Instead, you can create some nice looking drop shadows with the glow effect,

Internally, we downsize bitmap glyphs to the active font size. That way we don't require clients to use mipmap rendering which we don't have an API for now, and it also works with font effects too. Also, we still don't support modifiers / combined emojis / ligatures, so not all emojis are display correctly, for this we will need to implement #211.

Let me know how it works, and especially if there are any regressions with existing fonts.

Colorful emojis!

color_emojis

Color emojis with font effects

color_emojis_font_effects

@jack9267
Copy link
Author

Looks amazing, will test it out.

@mikke89 mikke89 closed this as completed Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants