~ubuntu-branches/ubuntu/trusty/pyx/trusty

« back to all changes in this revision

Viewing changes to pyx/font/encoding.py

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2006-11-26 14:04:53 UTC
  • mfrom: (2.1.3 edgy)
  • Revision ID: james.westby@ubuntu.com-20061126140453-1dq3cycpspmlik2t
Tags: 0.9-3
* New maintainer. Thank you for more than three years of
  maintenance,  Graham! Closes: #400087
* Don't hard-code python 2.3 in manual/Makefile.
  Thanks to Matthias Klose for the bug report and patch.
  Closes: #392634
* Remove obsolete dh_python call from debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: ISO-8859-1 -*-
 
2
#
 
3
#
 
4
# Copyright (C) 2005-2006 J�rg Lehmann <joergl@users.sourceforge.net>
 
5
# Copyright (C) 2005-2006 Andr� Wobst <wobsta@users.sourceforge.net>
 
6
#
 
7
# This file is part of PyX (http://pyx.sourceforge.net/).
 
8
#
 
9
# PyX is free software; you can redistribute it and/or modify
 
10
# it under the terms of the GNU General Public License as published by
 
11
# the Free Software Foundation; either version 2 of the License, or
 
12
# (at your option) any later version.
 
13
#
 
14
# PyX is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
#
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with PyX; if not, write to the Free Software
 
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
22
 
 
23
class encoding:
 
24
 
 
25
    def __init__(self, encvector):
 
26
        self.encvector = encvector
 
27
 
 
28
    def decode(self, char):
 
29
        return self.encvector[char]
 
30
 
 
31
    # XXX why do we need to pass the name during the outputPS call
 
32
    def outputPS(self, file, writer, name):
 
33
        file.write("%%%%BeginProcSet: %s\n" % name)
 
34
        file.write("/%s\n"
 
35
                   "[" % self.name)
 
36
        for i, glyphname in enumerate(self.encvector):
 
37
            if i and not (i % 8):
 
38
                file.write("\n")
 
39
            else:
 
40
                file.write(" ")
 
41
            file.write(glyphname)
 
42
        file.write(" ] def\n"
 
43
                   "%%EndProcSet\n")
 
44
 
 
45
    def outputPDF(self, file, writer):
 
46
        file.write("<<\n"
 
47
                   "/Type /Encoding\n"
 
48
                   "/Differences\n"
 
49
                   "[ 0")
 
50
        for i, glyphname in enumerate(self.encvector):
 
51
            if i and not (i % 8):
 
52
                file.write("\n")
 
53
            else:
 
54
                file.write(" ")
 
55
            file.write(glyphname)
 
56
        file.write(" ]\n"
 
57
                   ">>\n")
 
58
 
 
59
adobestandardencoding = encoding([None, None, None, None, None, None, None, None,
 
60
                                  None, None, None, None, None, None, None, None,
 
61
                                  None, None, None, None, None, None, None, None,
 
62
                                  None, None, None, None, None, None, None, None,
 
63
                                  "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright",
 
64
                                  "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash",
 
65
                                  "zero", "one", "two", "three", "four", "five", "six", "seven",
 
66
                                  "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question",
 
67
                                  "at", "A", "B", "C", "D", "E", "F", "G",
 
68
                                  "H", "I", "J", "K", "L", "M", "N", "O",
 
69
                                  "P", "Q", "R", "S", "T", "U", "V", "W",
 
70
                                  "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore",
 
71
                                  "quoteleft", "a", "b", "c", "d", "e", "f", "g",
 
72
                                  "h", "i", "j", "k", "l", "m", "n", "o",
 
73
                                  "p", "q", "r", "s", "t", "u", "v", "w",
 
74
                                  "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", None,
 
75
                                  None, None, None, None, None, None, None, None,
 
76
                                  None, None, None, None, None, None, None, None,
 
77
                                  None, None, None, None, None, None, None, None,
 
78
                                  None, None, None, None, None, None, None, None,
 
79
                                  None, "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section",
 
80
                                  "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl",
 
81
                                  None, "endash", "dagger", "daggerdbl", "periodcentered", None, "paragraph", "bullet",
 
82
                                  "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", None, "questiondown",
 
83
                                  None, "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent",
 
84
                                  "dieresis", None, "ring", "cedilla", None, "hungarumlaut", "ogonek", "caron",
 
85
                                  "emdash", None, None, None, None, None, None, None,
 
86
                                  None, None, None, None, None, None, None, None,
 
87
                                  None, "AE", None, "ordfeminine", None, None, None, None,
 
88
                                  "Lslash", "Oslash", "OE", "ordmasculine", None, None, None, None,
 
89
                                  None, "ae", None, None, None, "dotlessi", None, None,
 
90
                                  "lslash", "oslash", "oe", "germandbls", None, None, None, None])