Blame tools/generate/OpenType

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