engo icon indicating copy to clipboard operation
engo copied to clipboard

Font support for unicode characters?

Open riimi opened this issue 6 years ago • 3 comments

Hi! I am new to engo, into it these days. I have been trying to draw a string containing unicode characters: Korean, Chinese, Japanese. Do I have to implement a new shader for this? Thanks in advance!

riimi avatar Aug 14 '19 09:08 riimi

The font shader should be able to handle it, but right now it's limited to the first 200 glyphs from the font here. This is so that generating a font atlas happens quickly and gets everything you need, but also because I've never taken the time to use fonts containing those characters. I think the easiest fix would be to allow users to set the number of Glyphs used, and have it default to 200 if they don't.

Noofbiz avatar Aug 15 '19 23:08 Noofbiz

I solved the problem by increasing UnicodeCap according to your advice. But, the solution seems inefficient way because the font makes the big font atlas starting from index 0. I think I will have to find more efficient way to support multiple languages.

riimi avatar Aug 20 '19 07:08 riimi

Yeah I'm thinking of adding to fonts a []int that will let you decide which code points are used. If empty it'll do 0-200 for backwards compatibility. I think this is best because then if you only need 8 characters it'll only make 8 characters and not waste memory on the other ones.

Noofbiz avatar Aug 20 '19 15:08 Noofbiz