How to change font direction?
theju
thejaswi.puthraya at gmail.com
Sat Sep 16 01:44:28 EDT 2006
Well here are some self explanatory functions that I've written for
displaying the text vertically and from right to left. As for rotation
gimme some more time and i'll come back to you. Also I don't guarantee
that this is the best method(cos I myself am a newbie), but I can
guarantee you that it works.
Here it goes...
im=Image.open("imgfile.jpg")
draw=ImageDraw.Draw(im)
def verdraw(width,height,spacing,a="Defaulttext"):
for i in range(0,len(a)):
draw.text((width,height),a[i],(<options>))
height+=spacing
def right2leftdraw(width,height,spacing,a="Defaulttext"):
for i in range(0,len(a)):
draw.text((width,height),a[len(a)-i-1],(<options>))
width += spacing
<options> is a 3 field length tuple is mentioned in the PIL-Handbook.
Hope you find it useful
-Theju
Daniel Mark wrote:
> Hello all:
>
> I am using PIL to draw some graphics and I need to draw some texts
> in vertical direction rather than the default left-to-right horizontal
> direction.
>
> Is there anyway I could do that?
>
>
> Thank you
> -Daniel
More information about the Python-list
mailing list