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