-
Notifications
You must be signed in to change notification settings - Fork 174
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
Use stb_truetype for all text rendering #422
Conversation
Idea: Gosu currently uses OS APIs to locate and render fonts when a non-filename is passed as the |
895890f
to
b3d0e84
Compare
b3d0e84
to
a718eda
Compare
a718eda
to
4f9676b
Compare
4f9676b
to
cc79241
Compare
cc79241
to
a6b940d
Compare
a6b940d
to
8f7a4e8
Compare
4d5e6fd
to
44a3a32
Compare
44a3a32
to
ccbbb8f
Compare
When I run this:
...the result does not look satisfactory :/ – I've darkened the colors because white on transparent is invisible on GitHub: I need to check if this is caused by a terrible version of arial.ttf being loaded (shouldn't be?) or if my rendering code is just bad. Maybe I accidentally inverted the lsb offset? Edit: Fixed, yay - turns out the lsb is not actually something that Gosu should pay attention to. |
6b89dc5
to
aeefad3
Compare
This PR has been around long enough, I'll move the remaining bullet points into one or two separate branches. |
Goals:
Image.from_text(...).save(...)
Font
handle Unicode more sensibly by bundling & using utf8proc (fixes Font.cpp: Use UCS-4 on all platforms, maybe precompose? #359)Font#[]=
by a block passed to the constructor, for example:Font.new(...) { |grapheme| Image.new("glyphs/#{grapheme}.png") }
. The "default block" just happens to render the grapheme cluster usingImage.from_text
. This will also be the loophole to test grapheme cluster parsing—the block will be called once per cluster.register_entity
available in Ruby (it wasn't?!)Font#draw_markup
andImage.from_markup
as suggested in Fix the text/string mess #304, but make these aliases for the existing methods for now; Gosu 1.0.0 will then introduce a difference