hwoarang69 11 Newbie Poster
What I am using:

I am using java & libgdx to create a game in desktop & android.

Error:

Could not find class 'com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator', referenced from method com.aa.GameStates.MainMenu.init

so on desktop version, everthing work fine and no errors. Problem is when I run it on android.

What I am thinking:

So I am guess android cant use this "freeTypeFontGenerator" libary but desktop version can. Is there different font libary I can use, which is for android and desktop? Bc I really wan tto use hyperspace_bold.ttf

Code:
public void init() {
    FreeTypeFontGenerator gen = new FreeTypeFontGenerator(Gdx.files.internal("fonts/hyperspace_bold.ttf"));
    titleFont = gen.generateFont(56);
    titleFont.setColor(Color.WHITE);
    font = gen.generateFont(20);
}



public void draw() {
        sb.setProjectionMatrix(MyGdxGame.camera.combined);
        sb.begin();

        // draw Title - center
        float width = titleFont.getBounds(title).width;
        titleFont.draw(sb, title, (Constants.WINDOW_WIDTH - width) / 2, 300);

        // draw menu - center
        for (int i = 0; i < menuItems.length; i++) {
            width = font.getBounds(menuItems[i]).width;
            if (currentItem == i) {
                font.setColor(Color.RED);
            } else {
                font.setColor(Color.WHITE);
            }
            font.draw(sb, menuItems[i], (Constants.WINDOW_WIDTH - width) / 2,
                    180 - 35 * i);
        }
        sb.end();
    }
JamesCherrill commented: This is a shining example of the irght way to ask a question. +15