SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

Revision: 3982
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3982&view=rev
Author: mdboom
Date: 2007年10月23日 07:24:49 -0700 (2007年10月23日)
Log Message:
-----------
Marker objects should be keyed off of whether or not they are filled
and their line width (since the line width affects the bounding box).
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年10月23日 14:23:19 UTC (rev 3981)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年10月23日 14:24:49 UTC (rev 3982)
@@ -1024,7 +1024,7 @@
 
 def markerObject(self, path, trans, fillp, lw):
 """Return name of a marker XObject representing the given path."""
- key = (path, trans)
+ key = (path, trans, fillp is not None, lw)
 result = self.markers.get(key)
 if result is None:
 name = Name('M%d' % len(self.markers))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3989
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3989&view=rev
Author: mdboom
Date: 2007年10月23日 12:47:43 -0700 (2007年10月23日)
Log Message:
-----------
Fix bug in clipping rectangle in PDF
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年10月23日 19:20:21 UTC (rev 3988)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年10月23日 19:47:43 UTC (rev 3989)
@@ -32,7 +32,7 @@
 from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE, \
 LOAD_NO_HINTING, KERNING_UNFITTED
 from matplotlib.mathtext import MathTextParser
-from matplotlib.transforms import Bbox
+from matplotlib.transforms import Bbox, BboxBase
 from matplotlib.path import Path
 from matplotlib import ttconv
 # MGDTODO: Move this stuff
@@ -172,11 +172,8 @@
 return pdfRepr(r)
 
 # A bounding box
- elif isinstance(obj, Bbox):
- r = ["["]
- r.extend([pdfRepr(val) for val in obj.lbrt])
- r.append("]")
- return fill(r)
+ elif isinstance(obj, BboxBase):
+ return fill([pdfRepr(val) for val in obj.bounds])
 
 else:
 raise TypeError, \
@@ -1043,7 +1040,7 @@
 self.beginStream(
 object.id, None,
 {'Type': Name('XObject'), 'Subtype': Name('Form'),
- 'BBox': bbox })
+ 'BBox': list(bbox.lbrt) })
 self.writePath(path, trans)
 if fillp:
 self.output(Op.fill_stroke)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4282
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4282&view=rev
Author: mdboom
Date: 2007年11月14日 10:36:45 -0800 (2007年11月14日)
Log Message:
-----------
Fix bug in PDF backend.
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年11月14日 18:31:35 UTC (rev 4281)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年11月14日 18:36:45 UTC (rev 4282)
@@ -1758,6 +1758,8 @@
 try:
 different = bool(ours != theirs)
 except ValueError:
+ ours = npy.asarray(ours)
+ theirs = npy.asarray(theirs)
 different = ours.shape != theirs.shape or npy.any(ours != theirs)
 if different:
 break
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4493
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4493&view=rev
Author: mdboom
Date: 2007年11月28日 12:36:22 -0800 (2007年11月28日)
Log Message:
-----------
Fix PDF font size bug.
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年11月28日 20:13:47 UTC (rev 4492)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年11月28日 20:36:22 UTC (rev 4493)
@@ -175,7 +175,7 @@
 # A bounding box
 elif isinstance(obj, BboxBase):
 return fill([pdfRepr(val) for val in obj.bounds])
- 
+
 else:
 raise TypeError, \
 "Don't know a PDF representation for %s objects." \
@@ -341,7 +341,7 @@
 self.passed_in_file_object = True
 else:
 raise ValueError("filename must be a path or a file-like object")
- 
+
 self.fh = fh
 self.currentstream = None # stream object to write to, if any
 fh.write("%PDF-1.4\n") # 1.4 is the first version to have alpha
@@ -530,7 +530,7 @@
 
 firstchar = 0
 lastchar = len(fontinfo.widths) - 1
- 
+
 fontdict = {
 'Type': Name('Font'),
 'Subtype': Name('Type1'),
@@ -575,7 +575,7 @@
 'XHeight': 500, # TODO: this one too
 'FontFile': fontfileObject,
 'FontFamily': familyname,
- 'StemV': 50, # TODO 
+ 'StemV': 50, # TODO
 # (see also revision 3874; but not all TeX distros have AFM files!)
 #'FontWeight': a number where 400 = Regular, 700 = Bold
 }
@@ -620,7 +620,7 @@
 CMapName currentdict /CMap defineresource pop
 end
 end"""
- 
+
 def embedTTF(self, filename, characters):
 """Embed the TTF font from the named file into the document."""
 
@@ -833,7 +833,7 @@
 unicode_cmap = (self._identityToUnicodeCMap %
 (len(unicode_groups),
 "\n".join(unicode_bfrange)))
- 
+
 # CIDToGIDMap stream
 cid_to_gid_map = "".join(cid_to_gid_map).encode("utf-16be")
 self.beginStream(cidToGidMapObject.id,
@@ -848,7 +848,7 @@
 {'Length': unicode_cmap})
 self.currentstream.write(unicode_cmap)
 self.endStream()
- 
+
 descriptor['MaxWidth'] = max_width
 
 # Write everything out
@@ -902,7 +902,7 @@
 warnings.warn(("'%s' can not be subsetted into a Type 3 font. " +
 "The entire font will be embedded in the output.") %
 os.path.basename(filename))
- 
+
 if fonttype == 3:
 return embedTTFType3(font, characters, descriptor)
 elif fonttype == 42:
@@ -1054,7 +1054,7 @@
 'SMask': smaskObject})
 self.currentstream.write(data) # TODO: predictors (i.e., output png)
 self.endStream()
- 
+
 img.flipud_out()
 
 def markerObject(self, path, trans, fillp, lw):
@@ -1068,7 +1068,7 @@
 else:
 name = result[0]
 return name
- 
+
 def writeMarkers(self):
 for tup in self.markers.values():
 name, object, path, trans, fillp, lw = tup
@@ -1088,7 +1088,7 @@
 #@staticmethod
 def pathOperations(path, transform):
 tpath = transform.transform_path(path)
- 
+
 cmds = []
 for points, code in tpath.iter_segments():
 if code == Path.MOVETO:
@@ -1109,11 +1109,11 @@
 cmds.append(Op.closepath)
 return cmds
 pathOperations = staticmethod(pathOperations)
- 
+
 def writePath(self, path, transform):
 cmds = self.pathOperations(path, transform)
 self.output(*cmds)
- 
+
 def reserveObject(self, name=''):
 """Reserve an ID for an indirect object.
 The name is used for debugging in case we forget to print out
@@ -1249,7 +1249,7 @@
 marker, Op.use_xobject)
 lastx, lasty = x, y
 output(Op.grestore)
- 
+
 def _setup_textpos(self, x, y, angle, oldx=0, oldy=0, oldangle=0):
 if angle == oldangle == 0:
 self.file.output(x - oldx, y - oldy, Op.textpos)
@@ -1285,11 +1285,12 @@
 fonttype = 42
 else:
 fonttype = global_fonttype
- 
+
 if fonttype == 42 or num <= 255:
 self._setup_textpos(ox, oy, 0, oldx, oldy)
 oldx, oldy = ox, oy
 if (fontname, fontsize) != prev_font:
+ fontsize *= self.dpi/72.0
 self.file.output(self.file.fontName(fontname), fontsize,
 Op.selectfont)
 prev_font = fontname, fontsize
@@ -1300,11 +1301,12 @@
 # as XObjects using the 'Do' command.
 if global_fonttype == 3:
 for ox, oy, fontname, fontsize, num, symbol_name in glyphs:
+ fontsize *= self.dpi/72.0
 if is_opentype_cff_font(fontname):
 fonttype = 42
 else:
 fonttype = global_fonttype
- 
+
 if fonttype == 3 and num > 255:
 self.file.output(Op.gsave,
 0.001 * fontsize, 0,
@@ -1427,7 +1429,7 @@
 self.check_gc(gc, gc._rgb)
 if ismath: return self.draw_mathtext(gc, x, y, s, prop, angle)
 
- fontsize = prop.get_size_in_points()
+ fontsize = prop.get_size_in_points() * self.dpi/72.0
 
 if rcParams['pdf.use14corefonts']:
 font = self._get_font_afm(prop)
@@ -1441,12 +1443,12 @@
 y += font.get_descent() / 64.0
 
 fonttype = rcParams['pdf.fonttype']
- 
+
 # We can't subset all OpenType fonts, so switch to Type 42
 # in that case.
 if is_opentype_cff_font(font.fname):
 fonttype = 42
- 
+
 def check_simple_method(s):
 """Determine if we should use the simple or woven method
 to output this text, and chunks the string into 1-byte and
@@ -1476,7 +1478,7 @@
 """Outputs text using the simple method."""
 self.file.output(Op.begin_text,
 self.file.fontName(prop),
- prop.get_size_in_points(),
+ fontsize,
 Op.selectfont)
 self._setup_textpos(x, y, angle)
 self.file.output(self.encode_string(s, fonttype), Op.show, Op.end_text)
@@ -1503,7 +1505,7 @@
 if mode == 1:
 self.file.output(Op.begin_text,
 self.file.fontName(prop),
- prop.get_size_in_points(),
+ fontsize,
 Op.selectfont)
 
 for chunk_type, chunk in chunks:
@@ -1566,7 +1568,7 @@
 elif rcParams['pdf.use14corefonts']:
 font = self._get_font_afm(prop)
 l, b, w, h, d = font.get_str_bbox_and_descent(s)
- scale = prop.get_size_in_points() / 1000.0
+ scale = prop.get_size_in_points()
 w *= scale
 h *= scale
 d *= scale
@@ -1574,10 +1576,11 @@
 font = self._get_font_ttf(prop)
 font.set_text(s, 0.0, flags=LOAD_NO_HINTING)
 w, h = font.get_width_height()
- w /= 64.0
- h /= 64.0
+ scale = (1.0 / 64.0)
+ w *= scale
+ h *= scale
 d = font.get_descent()
- d /= 64.0
+ d *= scale
 return w, h, d
 
 def _get_font_afm(self, prop):
@@ -1780,7 +1783,7 @@
 different = ours.shape != theirs.shape or npy.any(ours != theirs)
 if different:
 break
- 
+
 if different:
 theirs = [getattr(other, p) for p in params]
 cmds.extend(cmd(self, *theirs))
@@ -1841,10 +1844,10 @@
 pass
 
 filetypes = {'pdf': 'Portable Document Format'}
- 
+
 def get_default_filetype(self):
 return 'pdf'
- 
+
 def print_pdf(self, filename, **kwargs):
 dpi = kwargs.get('dpi', 72)
 self.figure.set_dpi(dpi) # Override the dpi kwarg
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4523
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4523&view=rev
Author: mdboom
Date: 2007年11月30日 07:50:13 -0800 (2007年11月30日)
Log Message:
-----------
Cleanup some variable names.
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年11月30日 15:13:44 UTC (rev 4522)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年11月30日 15:50:13 UTC (rev 4523)
@@ -682,12 +682,12 @@
 descriptor['MaxWidth'] = max(widths)
 
 # Make the "Differences" array, sort the ccodes < 255 from
- # the two-byte ccodes, and build the whole set of glyph ids
+ # the multi-byte ccodes, and build the whole set of glyph ids
 # that we need from this font.
 cmap = font.get_charmap()
 glyph_ids = []
 differences = []
- two_byte_chars = Set()
+ multi_byte_chars = Set()
 for c in characters:
 ccode = ord(c)
 gind = cmap.get(ccode) or 0
@@ -696,7 +696,7 @@
 if ccode <= 255:
 differences.append((ccode, glyph_name))
 else:
- two_byte_chars.add(glyph_name)
+ multi_byte_chars.add(glyph_name)
 differences.sort()
 
 last_c = -2
@@ -715,7 +715,7 @@
 charprocDict = { 'Length': len(stream) }
 # The 2-byte characters are used as XObjects, so they
 # need extra info in their dictionary
- if charname in two_byte_chars:
+ if charname in multi_byte_chars:
 charprocDict['Type'] = Name('XObject')
 charprocDict['Subtype'] = Name('Form')
 charprocDict['BBox'] = bbox
@@ -726,9 +726,9 @@
 
 # Send the glyphs with ccode > 255 to the XObject dictionary,
 # and the others to the font itself
- if charname in two_byte_chars:
+ if charname in multi_byte_chars:
 name = self._get_xobject_symbol_name(filename, charname)
- self.two_byte_charprocs[name] = charprocObject
+ self.multi_byte_charprocs[name] = charprocObject
 else:
 charprocs[charname] = charprocObject
 
@@ -1297,7 +1297,7 @@
 self.file.output(self.encode_string(unichr(num), fonttype), Op.show)
 self.file.output(Op.end_text)
 
- # If using Type 3 fonts, render all of the two-byte characters
+ # If using Type 3 fonts, render all of the multi-byte characters
 # as XObjects using the 'Do' command.
 if global_fonttype == 3:
 for ox, oy, fontname, fontsize, num, symbol_name in glyphs:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4756
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4756&view=rev
Author: mdboom
Date: 2007年12月17日 07:41:34 -0800 (2007年12月17日)
Log Message:
-----------
Bugfix
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年12月17日 04:37:38 UTC (rev 4755)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py	2007年12月17日 15:41:34 UTC (rev 4756)
@@ -399,7 +399,7 @@
 self.nextImage = 1
 
 self.markers = {}
- self.two_byte_charprocs = {}
+ self.multi_byte_charprocs = {}
 
 # The PDF spec recommends to include every procset
 procsets = [ Name(x)
@@ -431,7 +431,7 @@
 xobjects = dict(self.images.values())
 for tup in self.markers.values():
 xobjects[tup[0]] = tup[1]
- for name, value in self.two_byte_charprocs.items():
+ for name, value in self.multi_byte_charprocs.items():
 xobjects[name] = value
 self.writeObject(self.XObjectObject, xobjects)
 self.writeImages()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /