-
Notifications
You must be signed in to change notification settings - Fork 52
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
Is it possible to use this with bitmap glyphs? #17
Comments
I think while the job gfx_glyph effectively does could apply outside of rusttype and gfx-rs, in reality our API has made a lot of assumptions on these two to simplify usage. I think glyph data having to come in from rusttype, and going out through gfx-rs, is a design limitation of gfx_glyph. Couldn't rusttype support bitmap fonts? |
https://github.com/redox-os/rusttype/issues/78 I've asked. If they say no then my next idea would be to start a new crate, with the intent of providing a single abstract API over bitmap fonts and vector fonts, with a backend of rusttype for vector fonts. |
So it looks like the new rusttype maintainer guy doesn't think this should go in rusttype. Not sure about that guy. So the rusttype bits don't apply too well to pre-baked glyphs, including the gpu_cache because it's all sub-pixelly and alpha-only. But perhaps gfx-glyph layout, and caching could still apply and be helpful. On the other hand maybe it's best to handle bitmaps separately even from gfx-glyph. Which I guess @icefoxen has already done in ggez. What do you guys think now a few months have gone by? |
I wrote an experimental facade to That means either ditching bitmap fonts altogether, maintaining two distinct APIs, writing a shim to (probably poorly) mimic the new behavior with none of the performance, or implementing a bitmap glyph cache of some sort. Naturally, fourth choice is the most desirable... However, I feel that doing that well falls a bit outside of |
I'm not terribly awake at the moment but it seems like |
Gfx-glyph is a LayoutThe layout code is all written around the rusttype font/glyph apis. It would honestly be a pain to generalise it. This is why I thought it would be good to get rusttype to support the font type. All the stuff needed to position glyphs should be implementable for any kind of font. TextureTexture management is mostly done by the Colour bitmaps can never live on the same texture as the outline fonts, though colourless ones could. Subpixel rendering must be handled differently for outlines & bitmaps. So here rusttype and bitmaps don't gel very well, and this makes me wonder if rusttype should be outline-only. VertexThis bit should be ok. A way forward?So maybe the rusttype drawing apis are the bit that don't fit.
The first step is the hardest. What kind of formats are most commonly used for bitmap fonts. Do you guys have some good example fonts to prototype with? |
Unfortunately this is an area for which good general purpose multiplatform support is lacking. I don't know of any such formats.
My best experience with this comes from XNA SpriteFonts. There's plenty of good examples of SpriteFont images here |
I can suggest |
Thinking about this more... it's annoying because it feels like it should be easy, since bitmap fonts are just a degenerate case of exactly what I wouldn't even try to deal with file formats, since as @Xaeroxe says, there aren't really any standards. It's one of those areas where it's so "simple" everyone rolls their own. Instead take a texture and a bunch of In terms of the pipeline described above, I believe this means that all the That said, for Also for reference, the |
This is a bit of a random question, but it occurs to me that if you're using a bitmap font atlas from ggez then you end up doing a fair bit of work that gfx_glyph does already, at least in terms of maintaining a glyph cache as a GPU texture plus metrics. Is it possible/feasible/interesting to make a way for gfx_glyph to suck in a texture and font metrics from a source outside of Rusttype, so we could use it to render (potentially variable-size) bitmap fonts?
The text was updated successfully, but these errors were encountered: