Scribble
Scribble copied to clipboard
Get Scribble working with font_add()... somehow
Needs checking against font_get_info()
but I don't hold much hope.
It was a nice dream while it lasted :(
Huh. Looks like font_get_info()
does work with font_add()
. Glyphs that have not been cached yet have an x
/y
position of -1
. I am a bit concerned about how this'll pan out if glyphs are removed from the cache at any point, but the best I can do is label it as a point of failure and move on.
From some of my testing, I haven't seen glyphs cache disappear at all. I've tried flushing the texture memory. Haven't had any issues with the texture or the glyphs at all. So we could cache the results of the glyphs after drawing the entire string, fetching the font info and storing it, and then add the texture as a sprite if there's concerns of the glyph/texture possibly being cleared at random?
jesus, this has been almost two years in the making now
That is has been indeed
Adding two gists to here that I've previously dabbled with when testing with making font_add()
work.
The current issues that lie at hand are:
- If you have too many characters in a font, it'll most likely break the fonts texture page itself (characters replacing eachother)
- There's a separate variable that controls the size of the font texture page
font_texture_page_size
. We can probably do this on the fly with a build script, since we can access this kind of information. - We don't necessarily have a way to manage all of these fonts together (whether they share the same texture page or have their own.)
- Very minor (and I don't know if we'd support it), but font families also do not work super well with Scribble (tested on Windows thus far.) Mainly Scribble is unable to pick up spacing from font families last I can recall. Font Families mostly just provide an easy way to add fonts from the system itself, rather than including a font file.
- Some glyphs may have an offset (needs testing)
I'm considering taking some pages from Collage and adding a mini texture page builder for the purpose of Scribble being able to store multiple font textures. And then if we get a large character set, Scribble can break the charset down into multiple fonts, extract their characters and data and add to a custom texture page. Making it easier (and more optimized for vertex/texture swaps).
If we were to go down this route, I'm happy to expand upon my current gists scripts (down below) that already do showcase some of the current issues at hand, and poke in a custom texture page builder for Scribble.
https://gist.github.com/tabularelf/f493624796dd8bbba85466101ad1eabd https://gist.github.com/tabularelf/94337b30295fcba67d57e7f2bb03ff16
I've realized from this comment here that the custom texture page side of things might not be as farfetched... Shouldn't hurt then to try this out.
Largely complete now. Thanks everyone for your help and advice.