Freetype font kerning on Android not working
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 25.4k
- Forks
- 6.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 5
Description
Issue details
Freetype font kerning works just fine when I run my code as desktop app, I can set kerning to true or false.
But on android device setting kerning true of false makes no difference, kerning is not there either way.
Tested with 3 different phones with different Android versions, issue is always present.
Below is an example. I downloaded the latest libGDX setup App and added some freetype font words to a newly generated default project.
The font I used is OpenSans-Bold.ttf, downloaded from Google Fonts, but I have tried other fonts too.

Reproduction steps/code
package com.mygdx.game;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
public class MyGdxGame extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
BitmapFont font;
@Override
public void create () {
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("OpenSans-Bold.ttf"));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = 50;
parameter.color = Color.WHITE;
parameter.kerning = true;
font = generator.generateFont(parameter); // font size 12 pixels
generator.dispose(); // don't forget to dispose to avoid memory leaks!
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0);
font.draw(batch, "START Yawn", 50, 460);
batch.end();
}
@Override
public void dispose () {
batch.dispose();
img.dispose();
}
}
Version of LibGDX and/or relevant dependencies
- libGDX 1.9.8
- Freetype extension checked in libGDX setup app
Please select the affected platforms
- Android
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the FreeTypeFontGenerator usage in the create() entry point and reproduce the sample on desktop and Android using OpenSans-Bold.ttf. Compare the generated font behavior with parameter.kerning set to true and false, then trace the Android font-generation path. Done means kerning behavior is consistent or the Android limitation is documented and covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100