How to create new font that can support contextual forms(Isolated,Initial,Medial and Final) to use in Nifty?

I need a Persian font to use in Nifty for Farsi Language.
I just used BMFont and Create an Arabic font which is near farsi and it is usable.
but there is a problem. Farsi and Arabic for each character have more than one symbol.
they have contextual forms of Isolated,Initial,Medial and Final
Persian_alphabet
for example we have 4 kind of B => ب , ﺑ , ـبــ , ـب
so it depends the where is the position of character in the word.
The font that I get from BMFont couldn’t be used. because when I use it سلام result to س ل ا م
which it means it just use the isolated form of each character.

I saw the fnt format and understood for each character we just have one symbol.
In the Binary file layout which is described in Bitmap Font Generator - Documentation it point to bitField which can have Unicode value. but it is not clear for me.
What should I do to create a font that can support contextual forms (Isolated,Initial,Medial and Final)?

Here is your explanation:
Arabic script in Unicode - Wikipedia

The problem seems to be: For those forms (Initial, Medial, Final) you need the additional glyphs from the
Arabic Presentation Forms-A (FB50—FDFF, 611 characters)
and
Arabic Presentation Forms-B (FE70—FEFF, 140 characters)

So what you need is:

  1. A font that includes those two unicode blocks.
  2. Then you can use BMFont.exe to create a .fnt file.
  3. A way to generate texts that uses these glyphs.

So, the problem is part 3.
You need to create a text using those (Initial, Medial, Final) instead of the (Isolated) form. Maybe there is already a good tool that can convert text - if you find such a tool, please tell me, because I want this for my game too. :chimpanzee_smile:

Hint: Google translate is a nice tool, because whenever I entered an English text, the corresponding translation always used the right Unicode glyphs already. I still hope that there are better tools to solve part 3. Because I doubt that Google translate would be used by the folks that localize your text (or my text). :chimpanzee_wink:

I wrote it for you!

1 Like

Nice job Younes!
You did the job that I intended to do more than one year ago, but swarming projects didn’t let me to achieve that.
I am a little busy about another project right now, and I will check it as soon as possible. making a sample project which using your code would complete your work for those are not master in Java like me. I am basically Delphi Developer and have 13 years experience in that. I am kinda addicted to Delphi and I wish JMonkey let me try a serious Java project.

I wish your code work with Lemur as well. I noticed that Lemur can use true type fonts. In android, it seems not working which I think there would no other choice, but choose BitmapFonts if someone decided to use that GUI.

And again! Thank you for your effort and your generosity to share with others.

I fixed it and now its font can use in lemur too [last version]

i tried it but its give me in nefty NumberFormatException xadvance Nifty.fromXml()

did you use that to make bitmap font from an Arabic font or a Persian font?

i wrote arial 20 0 for plain text

use b fonts like these.