Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

About internationalization and bitmap fonts #380

Open
lasagnaphil opened this issue May 13, 2016 · 3 comments
Open

About internationalization and bitmap fonts #380

lasagnaphil opened this issue May 13, 2016 · 3 comments

Comments

@lasagnaphil
Copy link

Currently, when looking at the api, it seems nearly impossible to render some i18n text (for example, Korean) because luxe only has the ability to load bitmap fonts. (It will probably be a pain to export all character sets into a giant bitmap font, because there are tens of thousands of Korean characters just to start with.)
The most straightforward solution seems to be adding functionality for loading ttf fonts. Any thoughts on the issue?

@ruby0x1
Copy link
Member

ruby0x1 commented May 13, 2016

I'm aware of the concern, and there will be an alternate path in the engine down the line. Since text can be so complex it doesn't make sense to implement all of that effort onto the placeholder renderer that is in there now.

I would note for interest sake, with SDF bitmap fonts, you can get quite a high number of characters into a single texture. If packed badly (without letter trimming), a size of 32 yields 4k characters in a 2048 texture (16k for 4096). If for instance the font wasn't being used for large headers AND small text, you could use multiple fonts. With 16 size characters, you can fit 16k in 2048 and 65k characters in a single 4096 texture.

With trimming you can get quite a few more, and if you don't try to use one font for every possible case in rendering your game, I can imagine it possible to fit the game specific headers and UI characters on their own, and user specified input with unknown used characters as a separate font instance. Even with two sizes you can cover quite a wide gamut of game specific text vs unknown input.

While this type of thing doesn't scale to say text editing applications, for games the scope of text requirements is somewhat more manageable. (side note: In the new rendering, this will also be implemented which allows smaller characters to remain crisp, and you could easily use this in the current code as well.)

On top of that, there are still options to use luxe with truetype fonts of course, you would just have to choose a workflow and do some of the work - like generating textures and rendering with them as bitmap fonts is viable for one extra step. On native using say linc_stb/Truetype which is already included in luxe by snow, and on web generating the characters on a canvas element and grabbing it's pixels to give to luxe as a texture to draw as a bitmap font. In a handful of code you could generate font textures dynamically and expand them as needed - like most ttf rendering would do anyway.

Of course I'm not saying it's not an issue or anything, or that luxe won't address this. There are all sorts of problems with the bitmap rendering (including them limiting to one texture page at the moment), they will be tackled.

Just know that it's important to me that other languages are handled well, and I'll be working hard to ensure that luxe is usable as wide as possible for it's goals of being a game engine.

@lasagnaphil
Copy link
Author

Thanks for the quick and thorough reply! I was considering to use this engine for my next personal game project, and realized it was almost perfect except for this one issue...
Well actually, by quick research there are about 11000 characters in Korean, which might be bearable for bitmap fonts according to your description, so this is less of a problem than I thought.

@ruby0x1
Copy link
Member

ruby0x1 commented May 13, 2016

Cool, keep in mind the alpha status and read the dev logs for where I'm headed with regards to finalizing the renderer and what not, once the core engine is more complete the higher level stuff will take priority. In other words, I'm glad you're considering the engine but take heed of the alpha label as I use it intentionally :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants