adobe-type-tools / afdko

Adobe Font Development Kit for OpenType
https://adobe-type-tools.github.io/afdko/
Other
1.04k stars 168 forks source link

Need help on proper uses of Makeotf in Lohit project #33

Closed pravins closed 9 years ago

pravins commented 9 years ago

This is not an issue with makeotf. But i am facing this while using it with Lohit project. Basically i am loosing font encoding after building font.

Following steps i am following:

  1. git clone https://github.com/pravins/lohit.git
  2. cd lohit/odia/
  3. ../generate.pe Lohit-Odia.sfd (This will generate Lohit-Odia.ttf)
  4. makeotf -f Lohit-Odia.ttf -ff Lohit-Odia.fea (It gives me following errors.)
makeotf [Note] Converting source font 'Lohit-Odia.ttf' to temporary Unix Type1 font file 'Lohit-Odia.ttf.tmp'.
makeotf [Note] Writing options file ./current.fpr
makeotf [Note] Running makeotfexe with commands:
   cd "/NotBackedUp/git/github/lohit/odia"
   makeotfexe "-f" "Lohit-Odia.ttf.tmp" "-o" "Lohit-Odia.ttf.temp_cff" -ff "Lohit-Odia.fea" -ga -gf "Lohit-Odia.ttf.temp.GOADB" -mf "FontMenuNameDB" -shw
makeotfexe [FATAL] Glyph renaming is requested, but the Glyph Alias And Order DB file was not specified.
makeotf [Error] Failed to build output font file 'Lohit-Odia.ttf.temp_cff'.

Then i modify makeotfexe command.

  1. makeotfexe "-f" "Lohit-Odia.ttf.tmp" "-o" "Lohit.ttf." -ff "Lohit-Odia.fea" -nga -mf "FontMenuNameDB" -shw

But problem is output Lohit.ttf does not have proper encoding.

Also how can i convert TTF to Type1 using makeotf presently is does conversion auto. Did not found any command for same.

miguelsousa commented 9 years ago

You need to have a GlyphOrderAndAliasDB file in the directory. That file needs to list all of the glyphs in the exact same order and with the exact same name as they appear in the source TrueType font.

makeotf cannot perform font format conversions. To convert from TrueType to Type 1 you need to use another tool in the FDK called tx. The command to run will be something like this, tx -t1 font.ttf > font.pfa

pravins commented 9 years ago

Thank you for quick reply. :) I thought it will take glyphnames and encoding from Lohit-Odia.ttf.

https://github.com/i-tu/Hasklig/blob/master/GlyphOrderAndAliasDB I see its format is unicode "(uniXXXX/uXXXX)" "glyphname in ttf-font" It looks like providing GDEF to makeoft.

Will try and reopen if any further information needed.

miguelsousa commented 9 years ago

Clarification: it's the second column of the GlyphOrderAndAliasDB that needs to be an exact match with the font.

pravins commented 9 years ago

Thank you @miguelsousa :+1:

be5invis commented 9 years ago

@miguelsousa however in my memory TTF does not record glyph names, so how can i get these names being used in GlyphOrderAndAliasDB?

readroberts commented 9 years ago

Use the tx command-line program to dump the glyph names: tx -dump -4 <path to font file>

## glyph[tag] {name,encoding}
glyph[1] {NULL,U+0000}
glyph[2] {CR,U+000D}
glyph[3] {space,U+0020}
glyph[4] {exclam,U+0021}
glyph[5] {quotedbl,U+0022}

then edit the output to be a list of glyph names.

Or use the spot tool: spot -nc <path to font file>

--- names[glyphId]=<name>
[0]=<.notdef@0> 
[1]=<NULL@1> 
[2]=<CR@2> 
[3]=<space@3> 
[4]=<exclam@4> 
[5]=<quotedbl@5> 

For the spot output, you need to strip off the @‌nn suffix.

This is where a text editor with good search and replace functions, like real regular expression support, is very useful. I favor BBedit, but there are many alternatives.

miguelsousa commented 9 years ago

however in my memory TTF does not record glyph names, so how can i get these names being used in GlyphOrderAndAliasDB?

That's true, the glyphs in TrueType fonts do not require to have names.

When a TTF does not have glyph names, I don't know exactly how to setup the GlyphOrderAndAliasDB file. If you can provide a TTF without glyph names I can try to find out.

readroberts commented 9 years ago

If no glyph names are supplied by the 'post' table, then the FDK simply refers to them by "glyph". Again, the 'tx -dump -4' output will provide glyph names used by 'makeotf'.

be5invis commented 9 years ago

@miguelsousa you can see this one: http://pan.baidu.com/s/1eQroRrs It is directly generated from my program (which generates a lot of overlapping shapes; they will be merged in FontForge).

miguelsousa commented 9 years ago

@be5invis below is a list of the first 50 glyph names I got from that file. These names are what you'll need to use in the second column of the GlyphOrderAndAlias file.

The command I used for getting the list was, tx -dump -4 pass0-iosevka-regular.ttf | sed 's/glyph\[[0-9]*\] {\(.*\),.*/\1/'

.notdef
space
uni0307
uni0308
uni030A
gravecomb
acutecomb
uni0302
uni030C
tildecomb
uni0304
uni0306
uni0311
hookabovecomb
uni030F
uni030B
uni0313
uni0312
uni0314
uni0342
g20
g21
uni0327
uni0328
uni0345
dotbelowcomb
uni0324
uni0330
uni0325
uni0331
uni032D
uni032E
uni032F
uni0326
A
V
W
X
Y
K
B
D
P
R
C
G
O
Q
U
F
be5invis commented 9 years ago

@miguelsousa thanks.