mcraiha/Unity-UI-emoji

non monospace fonts

Opened this issue · 4 comments

Hi, thank you for this package, it saved me a lot of work :)

Is it possible to make it work with non mono-space fonts ?
Using a non mono-space font (with a ui text inside a layout) makes the emojis position incorrect

I had to change the following line

TextGenerator textGen = textToEdit.cachedTextGenerator;

to

TextGenerator textGen = textToEdit.cachedTextGeneratorForLayout;

Here is an example

image

Thanks!

I did not test this with layouts. So if the layouts alter the positioning of characters then the Vector3 imagePos... part will be calculated incorrectly and emoji positions will be wrong.

Hi, thank you for your reply!!!
I have the same issue without layouts, but using a non monospace font

image

It seems there are missing spaces, how can I fix this ?

Thank you!

Check that your font has em quad character (U+2001). And if it is there then check that it is actually occupies square area.

Hi @mcraiha , I've just realized that I had a wrong pivot x:

Pivot X 0.8
Pivot Y 1.6

I changed Pivot X to 1.6 and got it to work, even with layouts !!

Thank you so much for your help!

Esteban