List of usage examples for com.badlogic.gdx.graphics.g2d BitmapFont getSpaceWidth
public float getSpaceWidth()
From source file:com.idp.engine.ui.graphics.base.IdpLogger.java
/** * Sets font that will be used to render the log. * @param font//from w w w.jav a 2s . c o m */ public void setFont(BitmapFont font) { this.font = font; if (font != null) { this.font.setColor(Color.LIGHT_GRAY); this.font.setUseIntegerPositions(true); this.lineLength = (int) (Gdx.graphics.getWidth() / font.getSpaceWidth()); this.lineHeight = (int) (font.getCapHeight() - font.getDescent() + 2); if (blackRectangle != null) blackRectangle.dispose(); this.blackRectangle = new Texture(1, 1, Pixmap.Format.RGB565); } }
From source file:seventh.client.gfx.GlythData.java
License:Open Source License
public static int getWidth(BitmapFont font, GlyphLayout bounds, String str) { bounds.setText(font, str);//ww w . j a v a2 s . co m int textWidth = (int) bounds.width + 1; // bug in libgdx, doesn't like strings ending with a space, // it ignores it if (str.endsWith(" ")) { textWidth += font.getSpaceWidth(); } return textWidth; }