From 822f61838790f22172b02a5ba14b78fc3200dcc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Mon, 19 May 2008 08:29:56 +0000 Subject: [PATCH] rename writer options (use more underscores after some internal discussion) git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@2997 069f4177-920e-0410-937b-c2a4a81bcd90 --- CHANGES | 4 ++-- examples/3dgraphs/surface.txt | 4 ++-- pyx/canvas.py | 2 +- pyx/font/font.py | 8 ++++---- pyx/mesh.py | 8 ++++---- pyx/pdfwriter.py | 10 +++++----- pyx/pswriter.py | 10 +++++----- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index d4e28962..6f6e6801 100644 --- a/CHANGES +++ b/CHANGES @@ -104,8 +104,8 @@ TODO: (using fonts without a metrics is still supported, but properly issues a warning now) - interface for basic TeX-less text output - - new PS and PDF writer options: fontstripping, textaspath, mashasbitmap, - mashasbitmap_resolution (TODO: documentation) + - new PS and PDF writer options: strip_fonts, text_as_path, mesh_as_bitmap, + mesh_as_bitmap_resolution (TODO: documentation) - graph modules: - graphxyz: fix position of z4 axis - fallbackrange for axes with vanishing range diff --git a/examples/3dgraphs/surface.txt b/examples/3dgraphs/surface.txt index 12346803..47ffaf86 100644 --- a/examples/3dgraphs/surface.txt +++ b/examples/3dgraphs/surface.txt @@ -18,8 +18,8 @@ enable the mash by bitmap replacement feature use the option `mashasbitmap` (together with its `mashasbitmap_resolution` option):: d = document.document([document.page(g)]) - d.writeEPSfile("color", mashasbitmap=1) - d.writePDFfile("color", mashasbitmap=1) + d.writeEPSfile("color", mesh_as_bitmap=1) + d.writePDFfile("color", mesh_as_bitmap=1) !! The underlying rectangular grid is created by the gridpos style. By changing its parameters you can also create the base rectangular grid from others than diff --git a/pyx/canvas.py b/pyx/canvas.py index e33ab4fa..8e2e3931 100644 --- a/pyx/canvas.py +++ b/pyx/canvas.py @@ -161,7 +161,7 @@ class _canvas(canvasitem.canvasitem): for item in self.items: if isinstance(item, style.fillstyle): context.fillstyles.append(item) - if not writer.textaspath: + if not writer.text_as_path: if isinstance(item, font.text_pt): if not context.textregion: file.write("BT\n") diff --git a/pyx/font/font.py b/pyx/font/font.py index 3f0a65c7..d5a6cd8b 100644 --- a/pyx/font/font.py +++ b/pyx/font/font.py @@ -52,7 +52,7 @@ class PST1file(pswriter.PSresource): def output(self, file, writer, registry): file.write("%%%%BeginFont: %s\n" % self.t1file.name) - if writer.stripfonts: + if writer.strip_fonts: if self.glyphnames: file.write("%%Included glyphs: %s\n" % " ".join(self.glyphnames)) if self.charcodes: @@ -275,7 +275,7 @@ class PDFfontfile(pdfwriter.PDFobject): self.charcodes.update(other.charcodes) def write(self, file, writer, registry): - if writer.stripfonts: + if writer.strip_fonts: self.t1file.getstrippedfont(self.glyphnames, self.charcodes).outputPDF(file, writer) else: self.t1file.outputPDF(file, writer) @@ -424,7 +424,7 @@ class T1text_pt(text_pt): if not self.ignorebbox: bbox += self.bbox() - if writer.textaspath: + if writer.text_as_path: if self.decode: if self.kerning: data = self.font.metric.resolvekernings(self.glyphnames, self.size_pt) @@ -506,7 +506,7 @@ class T1text_pt(text_pt): if not self.ignorebbox: bbox += self.bbox() - if writer.textaspath: + if writer.text_as_path: if self.decode: if self.kerning: data = self.font.metric.resolvekernings(self.glyphnames, self.size_pt) diff --git a/pyx/mesh.py b/pyx/mesh.py index e38de184..2b82c233 100644 --- a/pyx/mesh.py +++ b/pyx/mesh.py @@ -108,7 +108,7 @@ class mesh(canvasitem.canvasitem): for element in self.elements for node in element.nodes]) def processPS(self, file, writer, context, registry, bbox): - if writer.mashasbitmap: + if writer.mesh_as_bitmap: from pyx import bitmap, canvas import Image c = canvas.canvas() @@ -116,7 +116,7 @@ class mesh(canvasitem.canvasitem): fd, fname = tempfile.mkstemp() f = os.fdopen(fd, "wb") f.close() - c.pipeGS(fname, device="pngalpha", resolution=writer.mashasbitmap_resolution) + c.pipeGS(fname, device="pngalpha", resolution=writer.mesh_as_bitmap_resolution) i = Image.open(fname) os.unlink(fname) b = bitmap.bitmap_pt(self.bbox().llx_pt, self.bbox().lly_pt, i) @@ -142,7 +142,7 @@ class mesh(canvasitem.canvasitem): file.write("\n") def processPDF(self, file, writer, context, registry, bbox): - if writer.mashasbitmap: + if writer.mesh_as_bitmap: from pyx import bitmap, canvas import Image c = canvas.canvas() @@ -150,7 +150,7 @@ class mesh(canvasitem.canvasitem): fd, fname = tempfile.mkstemp() f = os.fdopen(fd, "wb") f.close() - c.pipeGS(fname, device="pngalpha", resolution=writer.mashasbitmap_resolution) + c.pipeGS(fname, device="pngalpha", resolution=writer.mesh_as_bitmap_resolution) i = Image.open(fname) os.unlink(fname) b = bitmap.bitmap_pt(self.bbox().llx_pt, self.bbox().lly_pt, i) diff --git a/pyx/pdfwriter.py b/pyx/pdfwriter.py index 2305c6b6..6cae9b65 100644 --- a/pyx/pdfwriter.py +++ b/pyx/pdfwriter.py @@ -288,7 +288,7 @@ class PDFwriter: def __init__(self, document, file, title=None, author=None, subject=None, keywords=None, fullscreen=0, writebbox=0, compress=1, compresslevel=6, - stripfonts=1, textaspath=0, mashasbitmap=0, mashasbitmap_resolution=300): + strip_fonts=1, text_as_path=0, mesh_as_bitmap=0, mesh_as_bitmap_resolution=300): self._fontmap = None self.title = title @@ -302,10 +302,10 @@ class PDFwriter: warnings.warn("compression disabled due to missing zlib module") self.compress = compress self.compresslevel = compresslevel - self.stripfonts = stripfonts - self.textaspath = textaspath - self.mashasbitmap = mashasbitmap - self.mashasbitmap_resolution = mashasbitmap_resolution + self.strip_fonts = strip_fonts + self.text_as_path = text_as_path + self.mesh_as_bitmap = mesh_as_bitmap + self.mesh_as_bitmap_resolution = mesh_as_bitmap_resolution # dictionary mapping font names to dictionaries mapping encoding names to encodings # encodings themselves are mappings from glyphnames to codepoints diff --git a/pyx/pswriter.py b/pyx/pswriter.py index 236bd4f8..121e3d79 100644 --- a/pyx/pswriter.py +++ b/pyx/pswriter.py @@ -94,13 +94,13 @@ class PSdefinition(PSresource): class _PSwriter: - def __init__(self, title=None, stripfonts=1, textaspath=0, mashasbitmap=0, mashasbitmap_resolution=300): + def __init__(self, title=None, strip_fonts=1, text_as_path=0, mesh_as_bitmap=0, mesh_as_bitmap_resolution=300): self._fontmap = None self.title = title - self.stripfonts = stripfonts - self.textaspath = textaspath - self.mashasbitmap = mashasbitmap - self.mashasbitmap_resolution = mashasbitmap_resolution + self.strip_fonts = strip_fonts + self.text_as_path = text_as_path + self.mesh_as_bitmap = mesh_as_bitmap + self.mesh_as_bitmap_resolution = mesh_as_bitmap_resolution # dictionary mapping font names to dictionaries mapping encoding names to encodings # encodings themselves are mappings from glyphnames to codepoints -- 2.11.4.GIT