[reportlab-users] A couple of TTF fixes
Marius Gedminas
reportlab-users@reportlab.com
Tue, 23 Jul 2002 11:48:58 +0200
This one fixes a possible saveState()/restoreState() interaction problem
with setFont -- one of the font attributes was not saved. I missed this
place in my original TTF patch.
Index: pdfgen/canvas.py
===================================================================
RCS file: /cvsroot/reportlab/reportlab/pdfgen/canvas.py,v
retrieving revision 1.103
diff -u -p -r1.103 canvas.py
--- pdfgen/canvas.py 28 May 2002 15:06:55 -0000 1.103
+++ pdfgen/canvas.py 23 Jul 2002 09:36:47 -0000
@@ -222,7 +222,7 @@ class Canvas:
d[i] = stateatts[i] #setattr(self, stateatts[i], state[i])
STATE_ATTRIBUTES = split("""
- _x _y _fontname _fontsize _textMode _leading _currentMatrix _fillMode
+ _x _y _fontname _fontsize _dynamicFont _textMode _leading _currentMatrix _fillMode
_fillMode _charSpace _wordSpace _horizScale _textRenderMode _rise _textLineMatrix
_textMatrix _lineCap _lineJoin _lineDash _lineWidth _mitreLimit _fillColorRGB
_strokeColorRGB""")
This one fixes problems with some fonts (as reported by Dinu Gherman).
It had appeared on this list before with some discussion following, but
it's still not present in the CVS for some reason.
Index: pdfbase/ttfonts.py
===================================================================
RCS file: /cvsroot/reportlab/reportlab/pdfbase/ttfonts.py,v
retrieving revision 1.2
diff -u -p -r1.2 ttfonts.py
--- pdfbase/ttfonts.py 2 Jul 2002 21:28:29 -0000 1.2
+++ pdfbase/ttfonts.py 23 Jul 2002 09:36:45 -0000
@@ -709,7 +709,13 @@ class TTFontFile(TTFontParser):
# The following tables are simply copied from the original
for tag in ('name', 'OS/2', 'cvt ', 'fpgm', 'prep'):
- output.add(tag, self.get_table(tag))
+ try:
+ output.add(tag, self.get_table(tag))
+ except KeyError:
+ # Apparently some of the tables are optional (cvt, fpgm, prep).
+ # The lack of the required ones (name, OS/2) would have already
+ # been caught before.
+ pass
# post - PostScript
post = "\x00\x03\x00\x00" + self.get_table('post')[4:16] + "\x00" * 16
And now for something completely different. Regarding tab elimination,
what do you think about eliminating trailing whitespace?
And I would like to ask for adding *.pyc/*.pdf/*.log to cvsignore.
Would a patch adding lots of .cvsignore files in all subdirs be
acceptable?
Marius Gedminas
--
If your company is not involved in something called "ISO 9000" you probably
have no idea what it is. If your company _is_ involved in ISO 9000 then you
definitely have no idea what it is.
(Scott Adams - The Dilbert principle)