<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
</head>
<body style="direction: ltr;" bgcolor="#ffff99" text="#000000">
<div bidimailui-direction-uniformity="mixed" style="direction: ltr;"
 class="moz-text-html" lang="x-western">
<p style="margin-bottom: 0cm; margin-top: 0pt; direction: ltr;">Writing
Latin text on
an image using PIL is easy.<br>
</p>
<div bidimailui-direction-uniformity="mixed" style="direction: ltr;"
 class="post-text">
<p style="direction: ltr;">However, when I try to write Hebrew
punctuation marks (called
"nikud" or &#1504;&#1497;&#1511;&#1493;&#1491;), the characters does not overlap (as it should). </p>
On supporting environment, these two words take up the same
space/width (the below example depend on your system, hence the image):
<p style="direction: ltr;">&#1505;&#1462;&#1508;&#1462;&#1512; &#1505;&#1508;&#1512;</p>
<p style="direction: ltr;">However when drawing the text with PIL i'd
get </p>
<p style="direction: ltr;">&#1505; &#1462; &#1508; &#1462; &#1512;</p>
<p style="direction: ltr;">Since the library probably doesn't obey
kerning(?) rules,the error (latter example) occurs in all the ttf fonts
I have installed (200+) beside
DejaVuSans.ttf and Lucida*.ttf, on which it works OK.<br>
</p>
<p style="direction: ltr;">See example as an image (url: <a
 href="http://tinypic.com/r/jglhc5/5" rel="nofollow">http://tinypic.com/r/jglhc5/5)</a><br>
See differences in rendering among <a
 href="http://tinypic.com/view.php?pic=sgiu1i&amp;s=3">various fonts
http://tinypic.com/view.php?pic=sgiu1i&amp;s=3</a><br>
</p>
</div>
<p style="margin-bottom: 0cm; margin-top: 0pt; direction: ltr;">I
guess this question is relevant also to Arabic and other similar
languages with overlapping characters.<br>
</p>
<br>
<p style="margin-bottom: 0cm; margin-top: 0pt;">Note:<br>
there's also a "bug" (or an unimplemented feature) not dealing with
bidirectional (bidi-, RTL) fonts. Meaning, Hebrew text on the image is
printed backwards. But that's another issue.<br>
<br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">Here's my original
discusstion on StackOverflow:</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><a
 href="http://stackoverflow.com/questions/993265/writing-text-with-diacritic-nikud-vocalization-marks-using-pil-python-image">http://stackoverflow.com/questions/993265/writing-text-with-diacritic-nikud-vocalization-marks-using-pil-python-image</a><br>
<br>
</p>
</div>
</body>
</html>