-
Notifications
You must be signed in to change notification settings - Fork 16
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
Custom fonts? #10
Comments
Assuming the user would handle loading image data. Then it would definitely be possible to implement custom fonts in the form of bitmap fonts. The default (only) font, is actually a bitmap font baked into the header. |
how would i go about creating one of these bitmap fonts? |
instead could you point me to where the font is baked in to the header? |
The baked in font data, is packed into You can see all the logic for unpacking the data, along with creating the font in the subsequent If you're able to and want to give a go at implementing it, then I'd happily mentor.
Essentially, you'd be able to just draw a font in any image editing application. However, you wouldn't be able to load it (easily), until that functionality is implemented of course. Then when you have the image data, you'd essentially need to define a list of glyphs ( Lines 173 to 183 in 8200fa7
|
as one more question in the struct _GLTglyph does x and y represent pixels offset or some other form of offset? same with w and h |
Yes, the x and y is the pixel position in the image data, and the w(idth) and h(eight) is the size in pixels. So knowing the glyph rect and the image size, then calculating UVs, is of course as follows:
|
the only hard part seems to be loading the image data isn't it |
btw how could I say convert a TTF to a bitmap one? |
If we take
There's many tools for that, if you just search "TTF to bitmap font". I've previously heard about Bitmap Font Generator, but I don't recall if I've used it. |
will this work on Linux? |
Hmm, doesn't seem so, or at least not in a straight forward manner. I just looked here on GitHub, and I found fontbm, which mentions Linux. But once again, I haven't used it, I literally just found it. |
I'll have to look into that later |
I fixed the "fontbm" link. |
Would definitely be cool to be able to specify multiple baked fonts. Something like gltUseFont(text, blob, blob_size, blob_glyph_count) |
is or will there be any way to use custom fonts?
The text was updated successfully, but these errors were encountered: