Example usage for com.badlogic.gdx.graphics.g2d BitmapFont computeVisibleGlyphs

List of usage examples for com.badlogic.gdx.graphics.g2d BitmapFont computeVisibleGlyphs

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d BitmapFont computeVisibleGlyphs.

Prototype

public int computeVisibleGlyphs(CharSequence str, int start, int end, float availableWidth) 

Source Link

Document

Returns the number of glyphs from the substring that can be rendered in the specified width.

Usage

From source file:org.matheusdev.ror.screens.ScreenGameMap.java

License:Open Source License

private Stack<String> splitIntoLinesRec(Stack<String> list, String line, BitmapFont font, float width) {
    int visible = font.computeVisibleGlyphs(line, 0, line.length(), width);
    if (line.length() > visible) {
        String head = line.substring(0, visible - 1);
        String rest = line.substring(visible, line.length() - 1);
        list.push(head);//from  w  w  w . ja  va 2  s .c  om
        return splitIntoLinesRec(list, rest, font, width);
    } else {
        list.push(line);
        return list;
    }
}