Unity-UI-emoji icon indicating copy to clipboard operation
Unity-UI-emoji copied to clipboard

non monospace fonts

Open eporral1 opened this issue 8 years ago • 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!

eporral1 avatar Jan 31 '17 17:01 eporral1

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.

mcraiha avatar Jan 31 '17 17:01 mcraiha

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!

eporral1 avatar Jan 31 '17 17:01 eporral1

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

mcraiha avatar Jan 31 '17 18:01 mcraiha

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

eporral1 avatar Jan 31 '17 18:01 eporral1