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

Emoji support #10873

Closed
Brickcaster opened this issue Sep 1, 2017 · 15 comments
Closed

Emoji support #10873

Brickcaster opened this issue Sep 1, 2017 · 15 comments

Comments

@Brickcaster
Copy link
Contributor

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Windows, Godot 2.1.4

Issue description:
Godot does not render many emojis. I attempted to use a RichTextLabel containing the text:

te😊x🌐t🔼ᴥ♻🚀❂☮☯🚀🎡🚢🍭💦🔻

And instead what renders is:

image

I did this using a dynamic font for the node and I tried loading EmojiOneColor-SVGinOT.ttf, OpenSansEmoji.ttf, and unifont-10.0.06.ttf all with very limited success. The EmojiOneColor comes with a demo which, when opened in Chrome, renders just fine in B&W including many of the symbols I'm looking to use. Finding an adequate demo of the other fonts is a bit more difficult than I imagined.

@eon-s
Copy link
Contributor

eon-s commented Sep 2, 2017

Maybe related to #6834 , 3 have better support of fonts with special characters.

@curly-brace
Copy link

allow using them in code editor too like variables 🔨

@eon-s
Copy link
Contributor

eon-s commented Sep 2, 2017

@curly-brace well, if you manage to get a font with emoji in the format supported by the editor it should be possible (settings uses a .font, I have no idea what is that).

@akien-mga
Copy link
Member

You can now use any TTF font in the editor itself (code editor included) and in games, so this should work fine.

If a TTF font contains glyphs and Godot doesn't render them, that needs to be investigated.

@Calinou
Copy link
Member

Calinou commented Jan 15, 2018

You can now use any TTF font in the editor itself (code editor included) and in games, so this should work fine.

Note that colored fonts aren't currently supported, though (this is important as most emoji fonts make use of colors).

@eon-s
Copy link
Contributor

eon-s commented Jan 15, 2018

Is working in editor, labels, node names, gdscript, debugger, terminal output.

Tested with https://github.com/eosrei/twemoji-color-font (of course, color does not work).

@reduz
Copy link
Member

reduz commented Jan 15, 2018 via email

@volzhs volzhs self-assigned this Jan 15, 2018
@volzhs
Copy link
Contributor

volzhs commented Jan 16, 2018

I'm trying on this.
I don't know why but it works only with Google Noto Emoji font... 😢

screenshot from 2018-01-16 09-43-34

@reduz
Copy link
Member

reduz commented Jan 16, 2018 via email

@volzhs
Copy link
Contributor

volzhs commented Jan 16, 2018

detecting color

bool has_color = FT_HAS_COLOR(face);
int error = FT_Load_Char(face, p_char, has_color ? FT_LOAD_COLOR : FT_LOAD_DEFAULT);

to raster

case FT_PIXEL_MODE_BGRA:
	wr[ofs + 2] = slot->bitmap.buffer[i * slot->bitmap.pitch + (j << 2) + 0];
	wr[ofs + 1] = slot->bitmap.buffer[i * slot->bitmap.pitch + (j << 2) + 1];
	wr[ofs + 0] = slot->bitmap.buffer[i * slot->bitmap.pitch + (j << 2) + 2];
	wr[ofs + 3] = slot->bitmap.buffer[i * slot->bitmap.pitch + (j << 2) + 3];
	break;

need to take care of DynamicFontAtSize::textures though...

@volzhs
Copy link
Contributor

volzhs commented Jan 16, 2018

I'm not sure that fonts downloaded from internet is really colored font beside google noto color emoji...
or I missed something to do with freetype to render rest colored fonts.

@reduz
Copy link
Member

reduz commented Jan 16, 2018 via email

@volzhs
Copy link
Contributor

volzhs commented Jan 16, 2018

yeah. i've done that too so far.
problem is checking and loading colored font correctly.

@volzhs
Copy link
Contributor

volzhs commented Jan 16, 2018

screenshot from 2018-01-16 11-45-06

as my research, freetype supports only CBDT format color font which Google supports also.
if font is CBDT format, it works fine.
now need to handle size of font rendering.

@volzhs
Copy link
Contributor

volzhs commented Jan 16, 2018

screenshot from 2018-01-16 15-56-04
😎 finally....
need to clean up codes, but also need to go to bed...
will make a PR, maybe tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants