remove shebang -- see comment 3 on https://bugzilla.redhat.com/bugzilla/show_bug...
[PyX/mjg.git] / pyx / font / encoding.py
bloba4d0fb1980a09b72724a88e6741849a1d1fe00f5
1 # -*- coding: ISO-8859-1 -*-
4 # Copyright (C) 2005 Jörg Lehmann <joergl@users.sourceforge.net>
5 # Copyright (C) 2005 André Wobst <wobsta@users.sourceforge.net>
7 # This file is part of PyX (http://pyx.sourceforge.net/).
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.
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.
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
23 class encoding:
25 def __init__(self, encvector):
26 self.encvector = encvector
28 def decode(self, char):
29 return self.encvector[char]
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")
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")
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])