Wednesday, September 17, 2014

Compiling Lohit fonts feature file with Adobe Font Development Kit

This first came to notice with issue "OTM error #13". Everything was working perfectly with fontforge, creating feature file and importing feature file back :)

But certainly above issue open up number of issues with this process. Font designers were not able to import .fea file due to this issue.

Thanks to Dave and Frank for pointing to issue and directing me towards Adobe Font Development Kit (AFDKO). Adobe is the one created specification for .fea file and provided nice tools to compile it.  Most of the information already available AT http://www.adobe.com/devnet/opentype/afdko/topic_overview.html 

 This blog is specifically to update how i am using AFDKO in Lohit project.

Steps:
1. Write open type tables for Lohit fonts in Fontforge.
2. Export .fea file
3. Generate .ttf by importing .fea file to it using following commands.
4. makeotf -f Lohit-Tamil.ttf -ff Lohit-Tamil.fea

Makeotf is python wrapper over makeotfexe. makeotfexe can not process .ttf generated from fontforge. 
In first step makeotf convert .ttf provided to unix Type1 font.

It fails with error but it generates unix Type1 font required for makeotfexe.

What errors :)

  makeotf command pass following arguments to makeotfexe

  "makeotfexe "-f" "Lohit-Tamil.ttf.tmp" "-o" "Lohit-Tamil.ttf.temp_cff" -ff "Lohit-Tamil.fea" -ga -gf "Lohit-Tamil.ttf.temp.GOADB" -mf "FontMenuNameDB" -shw"

In above argument  "-ga -gf "Lohit-Tamil.ttf.temp.GOADB"  are not required but somehow automatically gets added by makeotf.

* We should replace -ga with -nga for not using GlyphOrderAndAliasDB. GlyphOrderAndAliasDB file is provided for ease of writing feature file.

* User can write feature file with user friendly names and use GlyphOrderAndAliasDB for adding name required as per standard.

* If one not using  GlyphOrderAndAliasDB, he should remove "-ga -gf "Lohit-Tamil.ttf.temp.GOADB"  and put -nga instead.

But makeotf done one good job of converting source font 'Lohit-Tamil.ttf' to temporary Unix Type1 font file 'Lohit-Tamil.ttf.tmp'

You will requires FontMenuDB file. Its content should be as per fonts. Font Lohit
[psatpute@dhcp201-194 bengali]$ cat FontMenuNameDB
[Lohit-Devanagari]
    f=Lohit Devanagari
    s=Regular
    l=Lohit Devanagari

5. run makeotfexe removing problem cuasing arguments.
 makeotfexe "-f" "Lohit-Tamil.ttf.tmp" "-o" "Lohit.ttf" -ff "Lohit-Tamil.fea" -nga -mf "FontMenuNameDB" -shw

And here get you Lohit.ttf build by adding .fea file with AFDKO.

Hope so it will help to some others as well.

I specifically found this very useful for finding issues in Lohit-Devanagari.fea files.

No comments: