| 1 |
# vim: set filetype=python : |
| 2 |
from __future__ import print_function |
| 3 |
__license__ = """ |
| 4 |
This file is part of GNU FreeFont. |
| 5 |
|
| 6 |
GNU FreeFont is free software: you can redistribute it and/or modify it under |
| 7 |
the terms of the GNU General Public License as published by the Free Software |
| 8 |
Foundation, either version 3 of the License, or (at your option) any later |
| 9 |
version. |
| 10 |
|
| 11 |
GNU FreeFont is distributed in the hope that it will be useful, but WITHOUT |
| 12 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 13 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License along with |
| 16 |
GNU FreeFont. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
""" |
| 18 |
__author__ = "Stevan White" |
| 19 |
__email__ = "[email protected]" |
| 20 |
__copyright__ = "Copyright 2009, 2010, 2012, 2018 Stevan White" |
| 21 |
__date__ = "$Date:: 2018-06-03 21:57:09 +0200#$" |
| 22 |
__version__ = "$Revision: 3914 $" |
| 23 |
|
| 24 |
__doc__ = """ |
| 25 |
Convert fonts from FontForge's native SFD format to TrueType format |
| 26 |
First auto-hints whole font |
| 27 |
|
| 28 |
Old-style kern tables seem to be what is actually used by Windows and |
| 29 |
some Linux programs such as OpenOffice. |
| 30 |
|
| 31 |
According to the FAQ, need to pass Flags=(apple) to build Mac fonts. |
| 32 |
But this option seems to rule out old-style kern tables |
| 33 |
""" |
| 34 |
|
| 35 |
import fontforge |
| 36 |
from sys import argv |
| 37 |
from buildutils import * |
| 38 |
|
| 39 |
scriptname = argv[0]; |
| 40 |
argc = len( argv ) |
| 41 |
|
| 42 |
if argc > 1: |
| 43 |
for i in range( 1, argc ): |
| 44 |
f = fontforge.open( argv[i] ) |
| 45 |
ttfile = f.fontname + '.mac.ttf' |
| 46 |
vstr = trim_version_str( f ) |
| 47 |
print( 'Generating Mac TrueType file', ttfile, vstr ) |
| 48 |
f.selection.all() |
| 49 |
f.autoHint() |
| 50 |
f.autoInstr() |
| 51 |
# Mac OS Font Book doesn't like the old-kern flag |
| 52 |
#f.generate( ttfile, flags=('opentype','old-kern') ) |
| 53 |
f.close() |
| 54 |
else: |
| 55 |
print( 'Usage:', scriptname, 'font.sfd [font.sfd ...]' ) |