From: Michael S. <ms...@uc...> - 2015-09-03 22:56:38
|
> On Sep 3, 2015, at 2:41 PM, Kenneth Reid Beesley <krb...@gm...> wrote: > > >> On 3Sep2015, at 13:05, Dave Crossland <da...@la...> wrote: >> >> >> <snip> >> >> When "open -a FontForge" your script calls what I assume is the latest packaged release, at /Applications/FontForge.app, which is the same as double clicking that app icon in Finder. >> >> When you do so, you run this shell script: >> >> https://github.com/fontforge/fontforge/blob/master/osx/FontForge.app/Contents/MacOS/FontForge >> >> You would need to edit that shell script, and yours, to pass the arguments supplied to the actual fontforge executable. > > Whoa! That’s more than I anticipated. With respect, I think that this script is broken. Here’s what I’ve found: > > 1. I’ve just taken a look at the script you cite (following the exact link above). I’m not an shell-script expert by any means, and some of it makes my > eyes cross, but it ends with the following if-statement, which looks reasonable: > > if [ $# -eq 0 ] ; then > ( exec $WRAPPER $bundle_bin/fontforge -new & ) > else > ( exec $WRAPPER $bundle_bin/fontforge "$@" & ) > fi > > That means that if the script is called with no command-line arguments (i.e. the count of arguments, stored in $#, is zero [ $# -eq 0 ]) then > execute the $WRAPPER with > fontforge -new > which will bring up FontForge with a default empty new ISO-8859-1 font. That makes sense. > Else (if there is at least one command line argument) then execute the $WRAPPER with > fontforge “$@“ > As usual, $@ represents (is expanded to) all the original command-line arguments. That also makes perfect sense. It looks to me like the _intent_ of the script is to pass along the command-line arguments typed by the user. So the _intent_ was to allow me to invoke > $ fontforge myfont.otf > and have myfont.otf opened rather than a new empty font. Again, I think that was the _intent_ of the script, and it probably worked in some previous version. > *** The plot thickens ... > 2. But now I look at the FontForge.app/Contents/MacOS/FontForge script in the version that I just downloaded and installed (the downloaded disc image file is FontForge-2015-04-30-Mac.app.dmg, which I opened to find FontForge.app, which I dragged into /Applications/), and the final if-statement, shown above, has been changed, with the two call formulas conflated to the following single line: > $WRAPPER $bundle_bin/fontforge -new "$@“ & > That is, it looks like the current script is always calling fontforge with the -new argument followed by any user-supplied command-line arguments (which might be ignored in such a case). > **** Is there a shell-script expert in the house? > 3. I tried commenting out this one final line and substituting a copy of the if-statement shown above from a previous release, and that didn’t seem to help. I suspect that the problem lies in the definition of WRAPPER, which I haven’t figured out yet. It looks suspicious to me (see especially, in the same file, the definition and re-definition of WRAPPER before it is actually invoked inside the definition itself—-there’s also a suspicious call to WRAPPER that is commented out). The change to the final invocation(s) of fontforge looks suspicious. In short, I suspect that this script is broken, and I suggest that the problem lies in the definition of WRAPPER. Perhaps one of you is better than I am at reading and fixing such scripts. > Best, > Ken > There are some other problems with the script. In my case, WRAPPER is not the problem---as I am not using debug mode, it is empty. (Check the contents of /tmp/oo.) The greater problem is that when you try, for example, open -a "FontForge" fontname.sfd fontname.sfd is not passed to the fontforge shell script, and $# is set to 0. Thus the behavior you described. One should mention that the new empty file it opens is with a new copy of FontForge. The script fontforge-crash-reporter.py which is supposed to prevent multiple instances of FontForge is not there yet. In my experience, the only reliable way to open a font file with FontForge is through its open dialog, and I created a rather involved AppleScript upon which font files could be dropped, and which would respond to double-clicking on a font file by opening them in FontForge. Michael |