FontLab Forum
2012-05-16, 11:40:47 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the FontLab forum, read how to use it! Update: Archives from old MSN forums are now available on our forum.
 
   Home   Help Search Calendar Downloads Tags Login Register  
Del.icio.us Digg FURL FaceBook Stumble Upon Reddit SlashDot

Pages: [1]
  Print  
Author Topic: add kern table to OT font via sfntedit  (Read 5898 times)
yanone
Sr. Member
****

Karma: +0/-0
Germany Germany

Posts: 7


WWW
« on: 2009-03-19, 11:50:41 »

hello guys.

the problem: GPOS kerning for an arabic font results in fucked up kerning in indesign ME CS3. i already tried applying separate lookups and for altin and arabic and RightToLefts and things to the kern-feature to no avail.

possible solution: kern-table instead of GPOS/kern-feature. not cool, i know, but at least it works.
i can't generate the fonts with fontlab though, because it doesn't take other parts of my correct FDK syntax feature code. anyway i also want to implement the new mark-to-base and mark-to-mark stuff later, so the new FDK is my choice anyway. so i'm implementing a fontlab to FDK automated generation script. generation of the font works fine (thanks a lot for writing bug-free code).

here's the actual problem: i have to call sfntedit twice, right? once (-x) to extract the kern-table from a FL-generated font, and once to inject it (-a) into the shiny new FDK-generated font. it works fine from the command line, but not from the FL-script. the first call works (i get the file containing the kern table), the second doesn't, and there's not reason for it. if i output the command call, paste it and execute it from the console, it works. the exact same call.
i applied the correct setFDKToolsPath() which i already needed for makeotf to work from within fontlab.

thanks a lot, i'm helpless.
regards, yanone
Logged
yanone
Sr. Member
****

Karma: +0/-0
Germany Germany

Posts: 7


WWW
« Reply #1 on: 2009-03-19, 12:27:56 »

exit status of the sfntedit calls are 256, no response seems to be put out.
(exit status of the previous makeotf from the same script is 0 as it should be, and it puts out stuff).
Logged
Read Roberts (Adobe)
Moderator
Hero Member
*****

Karma: +6/-0
United States United States

Posts: 27

Fontlab Studio 5.0.4, built 2741, Mac OX 10.5


Email
« Reply #2 on: 2009-03-19, 12:43:00 »

Hi Yanaone;

1) sfntedit issues
You are correct that you need to call sfntedit twice as you describe. The issue may lie in how you are calling it from within Python. If you are using os.system(), you can run into two problems. Once is that any log info from sfntedit may get lost , as the connection between Python's stdout and stderr (what gets sent to a console window) and the FontLab "Ouput Window" is unreliable.  As result, sfntedit  could be reporting an error, and you won't see it. Another problem is that os.system spawns the command it is given as a separate process, and then Python continues on its execution thread while the command is executing simultaneously on its separate execution thread. This can lead to all sorts of timing issues, a bug problem if your Python script is working on the same file. It is much safer to use the os.popen call, as in:
  command = "sfntedit -x kern %s 2>&1" % (fontPath) # formatted text statement
  myPipe = os.popen(command)  # Opens a pipe -acts like a file - to a new process that it is executing the command
  log = myPipe.read()     # execute the command and collect any log output
  myPipe.close()  # close the pipe .Kills the process and gives your computer less to think about.
  print log  # show the log from sfntedit in the FontLab "Output Window"

makeotf puts out stuff because it always writes some log messages. sfntedit executes silently - no output messages - unless something goes wrong.

myPipe.read() doesn't return until the the command is all done, so you don't get timing issues. It also collects *all* of the output to stdout from the command. The "2>&1" works on both Mac and Windows command-lines to send error messages from a program to the same place as regular print commands, so the the "log" gets both the regular log output and error log output from the command.

If you are not using os.system, then I don't immediately have any suggestions, besides *really* making sure than you are operating on the files that you think you are, and are not stomping on the edited font file after adding the kern table.

2) GPOS kerning.

There is no reason that I know of that GPOS kerning can't work under InDesign ME. It can be fiendishly difficult to figure out, as separate lookups are additive: if a text sequence matches a rule in two different lookups, then both rules get applied successively. Also, remember that all GSUB rules get applied before GPOS rules. However, it can be done, and there are a number of fonts which do this. Take a look at AdobeArabic.otf. You might seek advice on doing this on the opentype list. I can't do so personally, as I only make the tools. Using them for complex scripts is a special expertise.

- Read Roberts


Logged
yanone
Sr. Member
****

Karma: +0/-0
Germany Germany

Posts: 7


WWW
« Reply #3 on: 2009-03-19, 13:07:13 »

Quote
t is much safer to use the os.popen call, as in:
your popen lines are the exact code i'm already using. originally for the reason that os.system doesn't return response output, just the exit code.

Quote
sfntedit executes silently - no output messages - unless something goes wrong.
it does output "Done.", doesn't it? i get that from the command line, so i should be seeing it as a result of myPipe.read(), right?

Quote
If you are not using os.system, then I don't immediately have any suggestions, besides *really* making sure than you are operating on the files that you think you are, and are not stomping on the edited font file after adding the kern table.
it's all right. what i do now is to add all the snftedit calls from the looped script to a shell script and execute it manually after the font generation. all works this way. but this can't be the solution.

but i'll post the GPOS-related details on the other list. getting GPOS-kerning to work would be the better way anyway.
« Last Edit: 2009-03-19, 13:41:14 by yanone » Logged
yanone
Sr. Member
****

Karma: +0/-0
Germany Germany

Posts: 7


WWW
« Reply #4 on: 2009-03-19, 13:37:01 »

the GPOS-kerning related post is here:
http://forum.fontlab.com/opentype-layout-feature-development/screwed-arabic-gposkerning-in-indesign-me-cs3-t349.0.html
Logged
k.l.
SIG: XFO
Hero Member
***

Karma: +3/-0
Germany Germany

Posts: 21


« Reply #5 on: 2009-04-15, 05:05:43 »

Hi Jan, I also generate fonts with FLS-AFDKO-sfntedit. My "solution" was: First, an FLS-based script does the preparations and at the end outputs a command ready for copy/paste into the Terminal. Then, copy the command from Output panel, paste it into the Terminal and hit "return" to start part 2. (In the beginning this also involved TTX/FontTools which runs considerably faster from the Terminal than from within FLS.)

Karsten
Logged
Tags:
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!