~asdfghjkl-deactivatedaccount1/python-imaging/gif-fix

« back to all changes in this revision

Viewing changes to PIL/ImageDraw.py

  • Committer: effbot
  • Date: 2006-07-05 20:36:11 UTC
  • Revision ID: svn-v4:be285980-f00d-0410-a9fe-d4747b46ecd0:pil:348
Load Imaging-1.1.6b1 into pil.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# The Python Imaging Library
3
 
# $Id: ImageDraw.py 2437 2005-05-25 20:56:41Z Fredrik $
 
3
# $Id: ImageDraw.py 2756 2006-06-19 06:07:18Z fredrik $
4
4
#
5
5
# drawing interface operations
6
6
#
22
22
# 2004-08-26 fl   Made Draw() a factory function, added getdraw() support
23
23
# 2004-09-04 fl   Added width support to line primitive
24
24
# 2004-09-10 fl   Added font mode handling
 
25
# 2006-06-19 fl   Added font bearing support (getmask2)
25
26
#
26
 
# Copyright (c) 1997-2004 by Secret Labs AB
27
 
# Copyright (c) 1996-2004 by Fredrik Lundh
 
27
# Copyright (c) 1997-2006 by Secret Labs AB
 
28
# Copyright (c) 1996-2006 by Fredrik Lundh
28
29
#
29
30
# See the README file for information on usage and redistribution.
30
31
#
259
260
            ink = fill
260
261
        if ink is not None:
261
262
            try:
262
 
                mask = font.getmask(text, self.fontmode)
263
 
            except TypeError:
264
 
                mask = font.getmask(text)
265
 
            self.draw.draw_bitmap(xy, mask, ink)
 
263
                mask, offset = font.getmask2(text, self.fontmode)
 
264
                xy = xy[0] + offset[0], xy[1] + offset[1]
 
265
            except AttributeError:
 
266
                try:
 
267
                    mask = font.getmask(text, self.fontmode)
 
268
                except TypeError:
 
269
                    mask = font.getmask(text)
 
270
            self.draw.draw_bitmap(xy, mask, ink)
266
271
 
267
272
    ##
268
273
    # Get the size of a given string, in pixels.