~ubuntu-branches/ubuntu/wily/python-imaging/wily

« back to all changes in this revision

Viewing changes to PIL/FontFile.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#
16
16
 
17
17
import os
18
 
import Image
 
18
from . import Image, _binary
19
19
 
20
20
import marshal
21
21
 
31
31
    for v in values:
32
32
        if v < 0:
33
33
            v = v + 65536
34
 
        fp.write(chr(v>>8&255) + chr(v&255))
 
34
        fp.write(_binary.o16be(v))
35
35
 
36
36
##
37
37
# Base class for raster font file handlers.
106
106
 
107
107
        # font metrics
108
108
        fp = open(os.path.splitext(filename)[0] + ".pil", "wb")
109
 
        fp.write("PILfont\n")
110
 
        fp.write(";;;;;;%d;\n" % self.ysize) # HACK!!!
111
 
        fp.write("DATA\n")
 
109
        fp.write(b"PILfont\n")
 
110
        fp.write((";;;;;;%d;\n" % self.ysize).encode('ascii')) # HACK!!!
 
111
        fp.write(b"DATA\n")
112
112
        for id in range(256):
113
113
            m = self.metrics[id]
114
114
            if not m:
128
128
        data = marshal.dumps((self.metrics, self.info))
129
129
 
130
130
        if zlib:
131
 
            data = "z" + zlib.compress(data, 9)
 
131
            data = b"z" + zlib.compress(data, 9)
132
132
        else:
133
 
            data = "u" + data
 
133
            data = b"u" + data
134
134
 
135
135
        fp = open(os.path.splitext(filename)[0] + ".pil", "wb")
136
136
 
137
 
        fp.write("PILfont2\n" + self.name + "\n" + "DATA\n")
 
137
        fp.write(b"PILfont2\n" + self.name + "\n" + "DATA\n")
138
138
 
139
139
        fp.write(data)
140
140