# vim: set filetype=python :
__license__ = """
This file is part of Gnu FreeFont.
Gnu FreeFont is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
Gnu FreeFont is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
Gnu FreeFont. If not, see <http://www.gnu.org/licenses/>.
"""
__author__ = "Stevan White"
__email__ = "stevan.white@googlemail.com"
__copyright__ = "Copyright 2009, 2010, 2012, Stevan White"
__date__ = "$Date: 2012-04-24 13:09:08 +0200 (Tue, 24 Apr 2012) $"
__version__ = "$Revision: 2245 $"
__doc__ = """
Convert fonts from FontForge's native SFD format to OpenType format
Issues: Currently, FontForge does not include gasp tables in OpenType fonts.
However, in Windows, that functionality is clearly present in other fonts.
The result, I think, is that hinting is applied to small font sizes when
it is inappropriate.
Therefore, hinting is presently turned off
"""
import fontforge
from sys import argv
from buildutils import *
scriptname = argv[0];
argc = len( argv )
if argc > 1:
for i in range( 1, argc ):
f = fontforge.open( argv[i] )
otfile = f.fontname + ".otf"
vstr = trim_version_str( f )
print "Generating OpenType file ", otfile, ' ', vstr
# Wanted to set to 'UniocdeBmp' if there were no high unicodes
# but all attemtps to determine that from Python failed.
f.encoding = 'UnicodeFull'
f.selection.all()
f.autoHint() # because without gasp table, small sizes ugly
f.generate( otfile, flags=('opentype','old-kern','round') )
f.close()
else:
print "Usage: " + scriptname + " font.sfd [font.sfd ...]"