Thai language support (SOLVED)


We have to use Thai language in our game, but some combining characters with triple parts is rendering wrong.

For example, string " ตตต ตัตัตั ตั้ตั้ตั้ " rendered as:

But should be (in text editor)

It is not possible to render Thai fonts now in Defold, and we can’t fix it on our side. Can it be fixed?



Do you only need it for Android and iOS?



Yea, our target platform is mobile



I can make a native extension to render text using system font, which correctly renders such things into a texture. Plus you don’t have to generate the font atlas in Defold, which can free up significant amount of disk space. If you are interested.



Thanks for your suggestion!

The system font is not satisfaction our needs. As I am understand, the game will have different font style, which depends from device fonts (for example, font size)? Not very good.

We are need to have ability to correct render our fonts in different languages and make sure, what game will look similar across all devices. And better to do this with default Defold tools.

Not good long-term solution for us at all.

1 Like


OK. System fonts are different on Android and iOS, but they are similar enough. Font size can be set to any value, plus outline, shadow, spacing. I can also implement loading font from a file, that should look almost identical.



Could you share original font file pls?



Sure. Here is it:

:Adobe Thai (49.8 KB)



Could you try ttf font instead, please? It could be known issue with otf fonts.

1 Like


It sounds good as intime solution, probably. But in anyway - it is bad solution to replace almost worked tool with another one.

In any case new tool it will have some troubles and it’s need to be supported all the time.



Any Thai TTF fonts rendered in same way. We have merged all our fonts in single TTF and we are got the same results

It is not problem of OTF fonts, it’s about rendering combined symbols (3 parts-symbol like ตั้ on Thai languages, ligatures)

1 Like


I haven’t heard of any general problems with rendering of Thai characters. @jhonny.goransson any ideas?

1 Like


Defold renders correctly, but It seems like it’s an issue with your font file. This is from photoshop:

This is from Defold:

The one on top is your font, the lower one is called ‘Ayuthaya’ and looks good to me :slight_smile:



Seems very strange, what I can’t make any thai font rendering correct.

Thanks for the proof! I will try another fonts to make it work right

edit: I can approve, that all is ok. Thanks!



Have one more question about Thai language

For example, I’m trying to render next symbols: “ม่เพี ที่ร่ ร็”

In text editor:

In defold editor:

Question about ligatures in “ร่”. Is is possible to render it correct in Defold? It is rendered too high

As I’m understand, this ligature symbols just drawing in previous letter place without any adjust.
Maybe it is not so critical, just the question.



We rasterize each glyph individually as it is returned from the java font loader. We don’t take into account any other characters.

Is the height of this ligature dependent on the previous/next character(s)?

I don’t think there’s an easy way to fix this currently without some major refactoring of our font system.

I have been playing with the idea how to make it possible for extension writers to supply their own glyphs to the engine. You use case is a good reminder that we need some context for the glyphs to render.
This is not in the roadmap yet though, so no ETA on this feature.



Yea, in Thai it depends on the previous char. There is can be more rules, that I don’t know now.

Thanks for the answer. How I says - it is not critical, but anyway for now we have no ability to fix it :slight_smile:

Just found the good picture to explain it:



The more I think about it, the upcoming Vertex format/Mesh Component feature from @sven should provide the tools for an extension writer to write their own font renderer. E.g. loading the (local) fonts on the device, and rasterize the glyphs into a texture on demand, and outputting a mesh.

This should also solve the old outstanding issue of being able to use the local fonts on a device for download size reasons.



If you remember I already have written a native extension for font rendering. It lacks support for Windows/Linux/HTML5, maybe someone could help with that. And loading local TTF files is on my todo list.
But I wanted to ask how meshes would help with such extension?



Sure, if you already rasterize directly to a texture, that works too.
It depends on what limitations you hit first I guess?
For instance, a glyph cache texture will most likely be much smaller than a unique texture with a lot of text. With a glyph cache texture you can also reuse that for multiple text nodes.