LibGDX: Vocalized Hebrew

Hello everyone!
I want to render Hebrew text in LibGDX.
There is just BitmapFont created in Hiero:

SpriteBatch batch;
BitmapFont fnt;

@Override
public void create () {
	batch = new SpriteBatch();
	fnt=new BitmapFont(Gdx.files.internal("font.fnt"));
}

@Override
public void render () {
	ScreenUtils.clear(0, 0, 0, 1);
	batch.begin();
	fnt.draw(batch, RTL.Hebrew.convert("שלום עליכם!"), 20, 400); //Shalom aleichem
	fnt.draw(batch, RTL.Hebrew.convert("שָׁלוֹם עֲלֵיכֶם!"), 20, 360); //Same, but vocalized
	batch.end();
}

The result is:
Untitled

Here I use FreeType:

SpriteBatch batch;
FreeTypeFontGenerator g;
FreeTypeFontParameter p=new FreeTypeFontParameter();
BitmapFont font;

@Override
public void create () {
	batch = new SpriteBatch();
	p.size=24;
	p.characters=FreeTypeFontGenerator.DEFAULT_CHARS+"אבגדהוזחטיךכלםמןנסעףפץצקרשת"
	+"ְֱֲֳִֵֶַָֹֻּֿׁׂ"
	+"״„”÷‚’׳"
	+new String(getChars((char) 0xfb2a, (char) 0xfb4b));
	g=new FreeTypeFontGenerator(Gdx.files.internal("Alef-Regular.ttf"));
	font=g.generateFont(p);
	font.setColor(0, 0, 0, 1);
	g.dispose();
}

@Override
public void render () {
	ScreenUtils.clear(0, 0, 0, 1);
	batch.begin();
	font.setColor(1, 1, 1, 1);
	font.draw(batch, RTL.Hebrew.convert("כָּל בְּנֵי הָאָדָם נוֹלְדוּ בְּנֵי חֹרִין וְשָׁוִים בְּעֶרְכָּם וּבִזְכֻיּוֹתֵיהֶם. שׂ שׁ"), 40, 400); //1st article of the UDHR, and after that the Shin letter, each one has its' own dot: the first one is for Sin [s], and the second one is for Shin [ʃ]
	batch.end();
	
}

And I get this:
Untitled

I read about Hiero, but how it works with LibGDX?

Could be that Hiero only generates glyphs for a certain character range and doesn’t load kerning information. Take a look at that.

1 Like