-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenGL* renderer: UTF-8 multi-byte symbols are not rendering #80
Comments
May be because the STB pre-renderer characters don't include those outside ASCII range? |
Yes, that may be true. But also `typedef` for `UnicodeCharacter` defined as
1 byte `char` may be a part of a problem.
…On Sat, May 19, 2018, 18:16 Bill Quith ***@***.***> wrote:
May be because the STB pre-renderer characters don't include those outside
ASCII range?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABY5eKBEgVINVyWzgbNWhaa5de4LinHYks5t0DdggaJpZM4UFuvp>
.
|
I think this is your problem because pre-rendered text |
All the text is UTF-8, but yes, I haven't dealt with multi-byte character encodings on all platforms. I don't know how STB font render works with UTF-8 multi-byte codes. |
Ok, I see issue, I will try to figure out how stb works with multibyte
symbols as soon as possible. And maybe only required fix will be changing
rendering character range and changing of UnicodeCharacter type.
…On Sat, May 19, 2018, 18:21 Bill Quith ***@***.***> wrote:
All the text is UTF-8, but yes, I haven't dealt with multi-byte character
encodings on all platforms. I don't know how STB font render works with
UTF-8 multi-byte codes.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABY5eMHvrCm_R3e2NjthgtTz57NvSeDxks5t0DiJgaJpZM4UFuvp>
.
|
Ok, that can be made an
I don't really want to have dependencies on many external libraries. Is there specific functionality that is required? I think UTF-8 to int may be all that is necessary and that is a one function that could go in Utility.
Yep. I think Allegro just bakes characters on the fly, whatever they are. I just added this range to get this to work. I mainly use Allegro so that is probably the most complete solution here. Does STB remember the baked information? I.e. can you later bake more characters into the same texture? In which case you could just cache them like Allegro. And render from the cache. |
I guess
It's pretty small, and contains of only several headers. But I'm agree, that dependencies are bad.
I guess yes, because utf-8 is a specification, where one symbol can be described in range of 1 to 6 bytes, but after decoding it will describe maximum 4 byte variable. But I think I can implement it myself without any particular problems.
Nope, It's just saving 1 byte per pixel image to buffer. It's not caching glyphs. I guess I can cache buffer for font and if required - add symbols to it, then update texture in GPU and continue rendering. This implementation also requires custom baking function. |
Agreed.
If the cpplib license is liberal you could copy the function and attribute it? I think a lot of the other functionality should be handled by C++1x.
TBH I don't know what is required here. Maybe have a look at the Allegro strategy. I think they have multiple texture glyph atlases. New one added when it fills up. Each new font/glyph/size is cached when it is used. Not sure how easy this would be in STB. Perhaps need a rect packer (which I think STB has). |
Perhaps this is what is needed: https://github.com/memononen/fontstash
This modification sounds interesting: https://github.com/akrinke/Font-Stash/ from memononen/fontstash#24. The idea with the ResourceLoader is that there could be different flavours and users can choose an appropriate one. Likely, they would write their own because most games have their own resource management. Perhaps another one could be added that supports FontStash, and/or its variant (@akrinke). |
I checked out https://github.com/akrinke/Font-Stash/. It's pretty interesting, but it's renderer uses OpenGL Compat Profile, that's not usable with OpenGL Core Profile. So font rendering algorithm will be reimplemented for OpenGL Core Profile. Also there is an
|
I guess a concern is that it looks like a significant fork from fontstash, and that receives bug fixes and new features, so this fork would get less/no support. But I guess if it's all functional and looks reasonable to maintain then it will effectively just become part of GWork. |
Might be useful https://github.com/DuffsDevice/tinyutf8 |
Hmm. This is extremely interesting library. First of all it has to be tested a little bit and if everything will be fine, it can replace standard string without any problems, I guess. |
Ah. I thought is was single header as no source directory (cpp in "Lib"!). License is liberal. If necessary you could take what you need and attribute? |
I was playing with https://github.com/memononen/fontstash on the DirectX11 renderer. This method is a better solution than the hack of expanding the limited character range.
topblast@e2b3e6e |
I'm gong to turn this into a bug and open a new issue for the "font module" #88 new feature. |
Issue:
cmake -DRENDER_OPENGL=true ..
See title.
I guess I can begin research about this issue is the near future.
The text was updated successfully, but these errors were encountered: