Skip to content
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

Get Scribble working with font_add()... somehow #87

Closed
JujuAdams opened this issue Jul 5, 2020 · 9 comments
Closed

Get Scribble working with font_add()... somehow #87

JujuAdams opened this issue Jul 5, 2020 · 9 comments
Labels
feature 💭 It would be extra good if...
Milestone

Comments

@JujuAdams
Copy link
Owner

No description provided.

@JujuAdams JujuAdams added the feature 💭 It would be extra good if... label Jul 5, 2020
@JujuAdams
Copy link
Owner Author

Needs checking against font_get_info() but I don't hold much hope.

@DragoniteSpam
Copy link

It was a nice dream while it lasted :(

@JujuAdams JujuAdams added this to the 8.0.0 milestone Dec 5, 2021
@JujuAdams
Copy link
Owner Author

JujuAdams commented Dec 10, 2021

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.

@JujuAdams JujuAdams modified the milestones: 8.0.0, 8.1.0 Dec 10, 2021
@tabularelf
Copy link
Contributor

tabularelf commented Mar 16, 2022

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?

@DragoniteSpam
Copy link

jesus, this has been almost two years in the making now

@tabularelf
Copy link
Contributor

That is has been indeed

@tabularelf
Copy link
Contributor

tabularelf commented Aug 12, 2022

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

@tabularelf
Copy link
Contributor

tabularelf commented Aug 12, 2022

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.

@JujuAdams JujuAdams removed this from the 8.1 milestone Sep 3, 2022
@JujuAdams JujuAdams added this to the 9.0 milestone Jan 22, 2023
@JujuAdams
Copy link
Owner Author

JujuAdams commented Feb 7, 2023

Largely complete now. Thanks everyone for your help and advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 💭 It would be extra good if...
Projects
None yet
Development

No branches or pull requests

3 participants