hwoarang69 11 Newbie Poster
What I am using:

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


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

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

public void draw() {

        // 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) {
            } else {
            font.draw(sb, menuItems[i], (Constants.WINDOW_WIDTH - width) / 2,
                    180 - 35 * i);
JamesCherrill commented: This is a shining example of the irght way to ask a question. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.