From 6f024dc624d793d6b45abc09ba895df775dd2766 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Wed, 26 Mar 2008 06:49:26 +0000 Subject: [PATCH] make encodings a writer property git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@2974 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/font/font.py | 8 ++++---- pyx/pdfwriter.py | 7 ++++--- pyx/pswriter.py | 7 ++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pyx/font/font.py b/pyx/font/font.py index 01ae48b7..898fef41 100644 --- a/pyx/font/font.py +++ b/pyx/font/font.py @@ -454,8 +454,8 @@ class T1text_pt(text_pt): fontname = self.font.name if self.decode: - encodingname = self.getencodingname(context.encodings.setdefault(self.font.name, {})) - encoding = context.encodings[self.font.name][encodingname] + encodingname = self.getencodingname(writer.encodings.setdefault(self.font.name, {})) + encoding = writer.encodings[self.font.name][encodingname] newfontname = "%s-%s" % (fontname, encodingname) registry.add(_ReEncodeFont) registry.add(PSreencodefont(fontname, newfontname, encoding)) @@ -528,8 +528,8 @@ class T1text_pt(text_pt): deco.decoratedpath(textpath, fillstyles=[]).processPDF(file, writer, context, registry, bbox) else: if self.decode: - encodingname = self.getencodingname(context.encodings.setdefault(self.font.name, {})) - encoding = context.encodings[self.font.name][encodingname] + encodingname = self.getencodingname(writer.encodings.setdefault(self.font.name, {})) + encoding = writer.encodings[self.font.name][encodingname] charcodes = [encoding[glyphname] for glyphname in self.glyphnames] else: charcodes = self.charcodes diff --git a/pyx/pdfwriter.py b/pyx/pdfwriter.py index 94d95810..05295552 100644 --- a/pyx/pdfwriter.py +++ b/pyx/pdfwriter.py @@ -305,6 +305,10 @@ class PDFwriter: self.stripfonts = stripfonts self.textaspath = textaspath + # dictionary mapping font names to dictionaries mapping encoding names to encodings + # encodings themselves are mappings from glyphnames to codepoints + self.encodings = {} + # the PDFcatalog class automatically builds up the pdfobjects from a document registry = PDFregistry() catalog = PDFcatalog(document, self, registry) @@ -381,9 +385,6 @@ class context: self.textregion = 0 self.trafo = trafo.trafo() self.fillstyles = [] - # dictionary mapping font names to dictionaries mapping encoding names to encodings - # encodings themselves are mappings from glyphnames to codepoints - self.encodings = {} def __call__(self, **kwargs): newcontext = copy.copy(self) diff --git a/pyx/pswriter.py b/pyx/pswriter.py index 13e75b53..1fda418d 100644 --- a/pyx/pswriter.py +++ b/pyx/pswriter.py @@ -100,6 +100,10 @@ class _PSwriter: self.stripfonts = stripfonts self.textaspath = textaspath + # dictionary mapping font names to dictionaries mapping encoding names to encodings + # encodings themselves are mappings from glyphnames to codepoints + self.encodings = {} + def writeinfo(self, file): file.write("%%%%Creator: PyX %s\n" % version.version) if self.title is not None: @@ -249,9 +253,6 @@ class context: self.linewidth_pt = None self.colorspace = None self.selectedfont = None - # dictionary mapping font names to dictionaries mapping encoding names to encodings - # encodings themselves are mappings from glyphnames to codepoints - self.encodings = {} def __call__(self, **kwargs): newcontext = copy.copy(self) -- 2.11.4.GIT