Discussion:
[fontforge-users] FontForge on OS X, opening an existing font
Kenneth Reid Beesley
2015-08-31 20:06:33 UTC
Permalink
On OS X, I have an executable file ~/bin/fontforge
that contains just

open -a FontForge

And if I enter

$ fontforge

it launches FontForge with a new/empty font. However, if I enter

$ fontforge <nameofexistingfonthere>

it still opens a new font. I’ve also tried defining fontforge as an alias, e.g. in Bash

alias fontforge=‘open -a FontForge ‘

and the effect is the same.

How can I launch fontforge on OS X and have it open an existing font, all from the command line?

Thanks,

Ken



********************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA






------------------------------------------------------------------------------
Jose Da Silva
2015-09-01 02:17:15 UTC
Permalink
Post by Kenneth Reid Beesley
How can I launch fontforge on OS X and have it open an existing font,
all from the command line?
Ok, I don't have a Mac, but I expect it should be somewhat similar...

First, you need to make sure you are in the current/same directory as the
fontfile you want to open, or you need to provide a path to the Font file.

For example, if you placed all your fonts in directory ~/Fonts
then you can do this:
$ fontforge ~/Fonts/myfile.sfd

or do this:
cd ~/Fonts
$ fontforge myfile.sfd

------------------------------------------------------------------------------
Kenneth Reid Beesley
2015-09-01 05:13:24 UTC
Permalink
Post by Jose Da Silva
Post by Kenneth Reid Beesley
How can I launch fontforge on OS X and have it open an existing font,
all from the command line?
Ok, I don't have a Mac, but I expect it should be somewhat similar...
First, you need to make sure you are in the current/same directory as the
fontfile you want to open, or you need to provide a path to the Font file.
For example, if you placed all your fonts in directory ~/Fonts
$ fontforge ~/Fonts/myfile.sfd
cd ~/Fonts
$ fontforge myfile.sfd
Hello Jose,

Thanks. I’ve tried all that. No matter what I do, FontForge keeps opening with
a new ISO-8859-1 font. It might be something to do with the OS X
application, which is in /Applications/FontForge and is opened with

$ open -a FontForge

A propósito, você é brasileiro? Obrigado pela resposta.

Ken


********************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA






------------------------------------------------------------------------------
marty39
2015-09-03 18:22:13 UTC
Permalink
Worked for me: cd to a directory that has a font in it, then "fontforge
fontname.ttf" and fontforge opens with the named font.

Question is: what version and what build do you have? I think I have an old
version built by a 3rd party for Mac OS X. After I enter the command, and
before the window opens with the font, I see

Copyright (c) 2000-2011 by George Williams.
Executable based on sources from 23:14 GMT 25-Feb-2011-ML-D.
Library based on sources from 13:48 GMT 22-Feb-2011.

I don't know what that says about the build, but the version is about 4 1/2
years old. Your version may vary.



--
View this message in context: http://fontforge.10959.n7.nabble.com/FontForge-on-OS-X-opening-an-existing-font-tp14850p14856.html
Sent from the User mailing list archive at Nabble.com.
marty39
2015-09-03 18:32:14 UTC
Permalink
Addendum:

On my system, "fontforge" is /usr/local/bin/fontforge,
and "file /usr/local/bin/fontforge" gives me:
/usr/local/bin/fontforge: Mach-O 64-bit executable x86_64

That is to say I don't have a shell script; I'm invoking the executable
directly.

BTW my system is Mac OS X version 10.9.5 (Mavericks) on a mid-2010 Mac Mini.



--
View this message in context: http://fontforge.10959.n7.nabble.com/FontForge-on-OS-X-opening-an-existing-font-tp14850p14857.html
Sent from the User mailing list archive at Nabble.com.
Dave Crossland
2015-09-03 19:06:44 UTC
Permalink
Post by marty39
Copyright (c) 2000-2011 by George Williams.
Executable based on sources from 23:14 GMT 25-Feb-2011-ML-D.
Library based on sources from 13:48 GMT 22-Feb-2011.
I don't know what that says about the build, but the version is about 4 1/2
years old. Your version may vary.
I'm surprised this is still working! Sadly the development of FontForge in
the last few years has introduced many regressions.
Kenneth Reid Beesley
2015-09-03 20:09:33 UTC
Permalink
Post by marty39
Worked for me: cd to a directory that has a font in it, then "fontforge
fontname.ttf" and fontforge opens with the named font.
Question is: what version and what build do you have? I think I have an old
version built by a 3rd party for Mac OS X. After I enter the command, and
before the window opens with the font, I see
Copyright (c) 2000-2011 by George Williams.
Executable based on sources from 23:14 GMT 25-Feb-2011-ML-D.
Library based on sources from 13:48 GMT 22-Feb-2011.
I don't know what that says about the build, but the version is about 4 1/2
years old. Your version may vary.
Dear marty39,

Thanks for your message.

I recently installed what I believe to be the latest version packaged for OS X.
When launched, the Help > About menu choice tells me

Version 18:12 AEST 1-May-2015


Ken

********************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
Dave Crossland
2015-09-03 19:05:45 UTC
Permalink
Post by Kenneth Reid Beesley
How can I launch fontforge on OS X and have it open an existing font, all
from the command line?
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.
Kenneth Reid Beesley
2015-09-03 21:41:13 UTC
Permalink
<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.
https://github.com/fontforge/fontforge/blob/master/osx/FontForge.app/Contents/MacOS/FontForge <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

********************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
Dave Crossland
2015-09-03 21:49:03 UTC
Permalink
Please repost this on https://github.com/fontforge/fontforge/issues/ :)
<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.
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
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
if [ $# -eq 0 ] ; then
( exec $WRAPPER $bundle_bin/fontforge -new & )
else
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 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 ...
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
********************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
fontforge-users mailing list
https://lists.sourceforge.net/lists/listinfo/fontforge-users
http://fontforge.10959.n7.nabble.com/User-f8781.html
--
Cheers
Dave
Kenneth Reid Beesley
2015-09-03 22:43:50 UTC
Permalink
Please repost this on https://github.com/fontforge/fontforge/issues/ <https://github.com/fontforge/fontforge/issues/> :)
Done.

Ken


<snip>

********************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
Michael Sharpe
2015-09-03 22:41:08 UTC
Permalink
<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.
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.
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
if [ $# -eq 0 ] ; then
( exec $WRAPPER $bundle_bin/fontforge -new & )
else
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 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 ...
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
Dave Crossland
2015-09-03 22:59:29 UTC
Permalink
Post by Michael Sharpe
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.
Please contribute this to the repo :)
Michael Sharpe
2015-09-03 23:33:44 UTC
Permalink
Post by Michael Sharpe
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.
Please contribute this to the repo :)
------------------------------------------------------------------------------
Sorry, but I don't know how to do that. I posted it as FF.app.zip at: https://dl.dropboxusercontent.com/u/3825336/TeX/index.html

Feel free to add this to the repo.

Michael
Dave Crossland
2015-09-04 02:41:57 UTC
Permalink
Ah, it depends on a propietary program, so we can't add it :(

Loading...