|
From: <jo...@us...> - 2009-09-20 19:47:54
|
Revision: 7800
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7800&view=rev
Author: jouni
Date: 2009-09-20 19:47:46 +0000 (Sun, 20 Sep 2009)
Log Message:
-----------
Fix usetex spacing errors in pdf backend.
Modified Paths:
--------------
branches/v0_99_maint/CHANGELOG
branches/v0_99_maint/lib/matplotlib/backends/backend_pdf.py
Modified: branches/v0_99_maint/CHANGELOG
===================================================================
--- branches/v0_99_maint/CHANGELOG 2009-09-20 17:05:15 UTC (rev 7799)
+++ branches/v0_99_maint/CHANGELOG 2009-09-20 19:47:46 UTC (rev 7800)
@@ -1,5 +1,7 @@
+2009-09-20 Fix usetex spacing errors in pdf backend. - JKS
+
2009-09-20 Fix off-by-one error in dviread.Tfm, and additionally protect
- against exceptions in case a dvi font is missing some metrics - JKS
+ against exceptions in case a dvi font is missing some metrics. - JKS
2009-09-15 Don't fail on AFM files containing floating-point bounding boxes - JKS
Modified: branches/v0_99_maint/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/backends/backend_pdf.py 2009-09-20 17:05:15 UTC (rev 7799)
+++ branches/v0_99_maint/lib/matplotlib/backends/backend_pdf.py 2009-09-20 19:47:46 UTC (rev 7800)
@@ -1416,7 +1416,14 @@
dvi.close()
# Gather font information and do some setup for combining
- # characters into strings.
+ # characters into strings. The variable seq will contain a
+ # sequence of font and text entries. A font entry is a list
+ # ['font', name, size] where name is a Name object for the
+ # font. A text entry is ['text', x, y, glyphs, x+w] where x
+ # and y are the starting coordinates, w is the width, and
+ # glyphs is a list; in this phase it will always contain just
+ # one one-character string, but later it may have longer
+ # strings interspersed with kern amounts.
oldfont, seq = None, []
for x1, y1, dvifont, glyph, width in page.text:
if dvifont != oldfont:
@@ -1436,16 +1443,18 @@
# Find consecutive text strings with constant y coordinate and
# combine into a sequence of strings and kerns, or just one
# string (if any kerns would be less than 0.1 points).
- i, curx = 0, 0
+ i, curx, fontsize = 0, 0, None
while i < len(seq)-1:
elt, next = seq[i:i+2]
- if elt[0] == next[0] == 'text' and elt[2] == next[2]:
+ if elt[0] == 'font':
+ fontsize = elt[2]
+ elif elt[0] == next[0] == 'text' and elt[2] == next[2]:
offset = elt[4] - next[1]
if abs(offset) < 0.1:
elt[3][-1] += next[3][0]
elt[4] += next[4]-next[1]
else:
- elt[3] += [offset*1000.0/dvifont.size, next[3][0]]
+ elt[3] += [offset*1000.0/fontsize, next[3][0]]
elt[4] = next[4]
del seq[i+1]
continue
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|