0 like 0 dislike
I need a table of characters with accented French characters, i. e.:"aéèêêêêîïôöùüç€".
It's the same for Germans, Spaniards etc... with their own accented character sets.

I have looked at the tutos about the TEXT function of PopcornFX but the example they give only explains how to substitute an existing character with another character.
This is not what I need, since I need all the characters that already exist and I want to add these accented characters in the unoccupied space of the character table.

I also searched the PopocornFx tutos and forum, but I didn't find anything. Maybe I missed something, I don't know.

In the current state this Text function is of little use to me.

Can someone tell me how to do it or where to find a tuto explaining how to do it?
Thank you in advance

Translated with www.DeepL.com/Translator
asked by Zeronimo (120 points)

1 Answer

0 like 0 dislike

Hi There,

The goal you wanna achieve is reachable, but not so easy to implement.

The main workflow to sample printable character in particles, is to use a sampler text (which gives you access to functions like "charCode" in scripts) and then use the returned value to remap this value into a TextureID's atlas in the particle's renderer.

For instance, the "int charCode(int charId)" function, will give you the Ascii code for that character. Let's say you wanna draw an exclamation point '!', charCode will return "33" which is his corresponding ascii code. In our example, our atlas starts at the 32th ascii code ("space"), because all previous character are not printable. That's why in the script, we apply an offset of 32 to get the corresponding character in the atlas.
("TextureID = TextSampler.charCode(somenumber) - 32") = 1 -> '!' in the atlas.
Here is an example of a simple ascii table  (there is others ascci tables, depending of your computer localization, but we will discuss that later)

To sum up, you will not be able to print accented-french-characters with our atlas, since it only provides you access a limited range of character (ascii code from 32 to 126, from '!' to '~', from 0 to 94 in our atlas). The only way for you to print accented character is to create an atlas of you own, or you can also extend our atlas with the characters you need (there is some place to add something like 40 characters). But you will need to use a software like photoshop to create/modify the texture, and our Atlas builder to create/modify the corresponding atlas.

Just be careful of how you will remap the charCode return value to the TextureID field. Our example is convenient to use because from 32 to 95, charCode is just an offset of 32 of the ascci table, but if you add the character 'á' (ascii 225) to the atlas and bind it at the 97th position, you will need in the script to add an other offset if charCode > 95 (in this example it will be 128, but it depend on how you create your texture/atlas).

Finally, as i mentioned it above, from the 127th ascii code, the 'charCode' return value will might not return the same id depending of your computer localization. French ascci table vs Russian ascii table

I hope sincerely my explanations will help you, if you need any more informations, or any further explanations, just let me know.


answered by Maxime (5.3k points)