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

Support for loading BitmapFonts from TextureAtlases #2110

Merged
merged 7 commits into from Sep 7, 2014

Conversation

JesseTG
Copy link
Contributor

@JesseTG JesseTG commented Jul 13, 2014

I haven't actually tested this yet, I'm in the process of doing that, but I wanted to get some feedback first.

Anyway, isn't it weird that BitmapFonts can be created from TextureRegions, but you can't do so within a BitmapFontLoader? Being able to do so would be really, really convenient. Putting your fonts in the same atlas as your sprites would improve performance, and this PR makes it easier to do so.

An update to the BitmapFontTest is on the way.

@badlogic
Copy link
Member

Makes sense to add support for this. Your current implementation has a couple of flaws. E.g. if an atlas is given, you still request textures as deps as well. Also not sure if ref counting works properly with this setup (e.g. does the font own the atlas and disposes of it?).

import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem right,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably for the Skin reference in the javadocs (for better or worse).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

regs[i] = new TextureRegion(manager.get(data.getImagePath(i), Texture.class));
if (parameter.atlasName != null) {
// If we want to load this font from a texture atlas...
if (manager.getLoader(TextureAtlas.class) == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this check?

@badlogic badlogic merged commit 55a518c into libgdx:master Sep 7, 2014
@badlogic
Copy link
Member

badlogic commented Sep 7, 2014

Fixed things up myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants