added recalcBBoxes argument to TTFont.__init__()

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@10 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
Just 1999-12-18 18:06:25 +00:00
parent 8bc8cf850d
commit 88cb4f33c6

View File

@ -41,7 +41,7 @@ Dumping 'prep' table...
""" """
__author__ = "Just van Rossum, just@letterror.com" __author__ = "Just van Rossum, just@letterror.com"
__version__ = "$Id: __init__.py,v 1.3 1999-12-17 12:54:19 Just Exp $" __version__ = "$Id: __init__.py,v 1.4 1999-12-18 18:06:25 Just Exp $"
__release__ = "1.0a6" __release__ = "1.0a6"
import os import os
@ -60,7 +60,8 @@ class TTFont:
""" """
def __init__(self, file=None, res_name_or_index=None, def __init__(self, file=None, res_name_or_index=None,
sfntVersion="\000\001\000\000", checkchecksums=0, verbose=0): sfntVersion="\000\001\000\000", checkchecksums=0,
verbose=0, recalcBBoxes=1):
"""The constructor can be called with a few different arguments. """The constructor can be called with a few different arguments.
When reading a font from disk, 'file' should be either a pathname When reading a font from disk, 'file' should be either a pathname
@ -81,10 +82,15 @@ class TTFont:
The TTFont constructor can also be called without a 'file' The TTFont constructor can also be called without a 'file'
argument: this is the way to create a new empty font. argument: this is the way to create a new empty font.
In this case you can optionally supply the 'sfntVersion' argument. In this case you can optionally supply the 'sfntVersion' argument.
If the recalcBBoxes argument is false, glyph bounding boxes will
not be recalculated, but taken as they were. This is needed with
certain kinds of CJK fonts (ask Werner Lemberg ;-).
""" """
import sfnt import sfnt
self.verbose = verbose self.verbose = verbose
self.recalcBBoxes = recalcBBoxes
self.tables = {} self.tables = {}
self.reader = None self.reader = None
if not file: if not file:
@ -114,17 +120,17 @@ class TTFont:
if self.reader is not None: if self.reader is not None:
self.reader.close() self.reader.close()
def save(self, file, make_suitcase=0): def save(self, file, makeSuitcase=0):
"""Save the font to disk. Similarly to the constructor, """Save the font to disk. Similarly to the constructor,
the 'file' argument can be either a pathname or a writable the 'file' argument can be either a pathname or a writable
file object. file object.
On the Mac, if make_suitcase is non-zero, a suitcase file will On the Mac, if makeSuitcase is true, a suitcase (resource fork)
we made instead of a flat .ttf file. file will we made instead of a flat .ttf file.
""" """
import sfnt import sfnt
if type(file) == types.StringType: if type(file) == types.StringType:
if os.name == "mac" and make_suitcase: if os.name == "mac" and makeSuitcase:
import macUtils import macUtils
file = macUtils.SFNTResourceWriter(file, self) file = macUtils.SFNTResourceWriter(file, self)
else: else: