[Image-SIG] Truetype representation in Windows and Linux
bob at redivi.com
Sat Jul 29 22:53:22 CEST 2006
The FreeType port on FreeBSD has an option to *turn off* the bytecode
interpreter (WITHOUT_TTF_BYTECODE_ENABLED). Presumably that's not the
issue because you'd have had to intentionally turn it off.
Perhaps FreeType's implementation just isn't as good as the one in
On Jul 29, 2006, at 12:31 PM, <daniel at roseman.org.uk>
<daniel at roseman.org.uk> wrote:
> Thanks for the tip. Any clues on how to go about this? I'm actually
> using the FreeBSD
> ports (I lied about Linux) and I'm not really up to speed with
> building stuff. What
> would I need to run to fix this?
> Sorry about the newbie questions and thanks for any help.
> On Sat, 29 Jul 2006 14:54:04 -0400 (EDT), "Adam Twardoch"
> <adam at twardoch.com> wrote:
>> My guess is that on your Windows machine, FreeType (that is used
>> to render
>> texts from PIL) is compiled with native TrueType hinting support
>> while on Linux, you have FreeType without native TrueType hinting
>> You'd need to build FreeType with native TrueType hinting enabled
>> to get
>> the same results as on Windows.
>>> I'm using PIL to dynamically create graphical text headers for my
>>> using a truetype font. Testing this at home on my Windows box works
>>> When I upload it to the Linux server, the fonts appear subtly
>>> the size of the overall image isn't quite right, and the text
>>> either squashed or spaced wrongly.
>>> Here's the relevant code:
>>> imf = ImageFont.truetype(fontfile, int(fontsize))
>>> size = imf.getsize(header)
>>> im = Image.new("RGB", size, "white")
>>> draw = ImageDraw.Draw(im)
>>> draw.text((0, 0), header, font=imf, fill=colour)
>>> With fontfile and fontsize set to the relevant values, and using
>>> text "Randomtext", this produces an image of size 227x44 on
>>> Windows and
>>> 229x44 on Linux - doesn't sound like much, but the difference is
>>> noticeable (and the designer will kill me). Both machines are
>>> Python 2.4.2 and PIL 1.1.5.
>>> Any ideas, anyone?
>>> Image-SIG maillist - Image-SIG at python.org
> Image-SIG maillist - Image-SIG at python.org
More information about the Image-SIG