2

This is an issue I already asked about and several got answers but the problem remained. when I try to write in hebrew to an image using Image module I get instead of the hebrew lettring some other (ascii??) lettering. if I convert to unicode or ascii I get an error that it doesn't support. I got here a reference to a code that does what I want in chinese:

import sys

import Imag

import ImageDraw

import ImageFont

import _imaging

txt = '你好,世界!'

font = ImageFont.truetype('c:/test/simsun.ttc',24)

im = Image.new("RGBA",(300,200),(0,0,0))

draw = ImageDraw.Draw(im)

#draw.text( (0,50), u'你好,世界!', font=font)

draw.text( (0,50), unicode(txt,'UTF-8'), font=font)

but then I get an error:ImportError:

The _imagingft C module is not installed.

the same goes when I try to use standrad hebrew font 'arial.ttf' (with hebrew string ofcourse). as you can see I have imported _imaging succsefuly so the problem doesn't lay there as suggested by effbot.org.

it seem that the problem is with the Imagefont.truetype(...).

any help will be very appriciated

Kobi
  • 135,331
  • 41
  • 252
  • 292
ariel
  • 795
  • 2
  • 9
  • 11

2 Answers2

3

Sounds like PIL was built without FreeType support. Install the FreeType dev files and rebuild PIL again.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
1

the problem was the PIL 1.1.7 doesn't work well with windows XP. the same code runs well under linux or with XP but with PIL 1.1.6 mystory is solved

ariel
  • 795
  • 2
  • 9
  • 11