我以前的相关问题:
我的问题是:
????图像,则显示为? ? ? ?? ? ? ?使用此功能:
function arab($word){
$w = explode(' ',$word) ;
$f = array(array('?','?'),'?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?');
$t = array(array('?_','?_'),'?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_','?_');
$my_arab = '' ;
foreach($w as $wo)
{
$r = array() ;
$wo = str_replace($f , $t ,$wo);
$ne = explode('_', $wo) ;
foreach($ne as $new) {
$new = str_replace('_','',$new) ;
array_unshift($r , $new);
}
$my_arab .= ' '.implode('',$r) ;
}
return trim($my_arab) ;
}
Run Code Online (Sandbox Code Playgroud)
但新问题是:
? ? ? ?
(分开的字母)它应该是: …
我正在使用 Pillow / PIL 用 nikud 绘制希伯来字母。我注意到 nikudim(nikud 的复数形式)没有正确对齐,有时会与其他字母重叠。
\n\n有什么建议的修复方法吗?我尝试了几种字体,它们似乎都有自己的问题。
\n\n这是我正在使用的代码。
\n\nfrom bidi.algorithm import get_display\nfrom PIL import Image, ImageDraw, ImageFont\n\nfonts = [\n (\'Tammey FranckCLM\', \'/PATH/TO/FONT/TaameyFrankCLM-Medium.ttf\'),\n (\'Times New Roman\', \'/PATH/TO/FONT/Times New Roman.ttf\'),\n (\'Arial\', \'/PATH/TO/FONT/Arial.ttf\')\n]\n\nim = Image.new(mode=\'RGBA\', size = (1000, 1000), color = (0, 0, 0, 255))\ndraw = ImageDraw.Draw(im)\n\nheight = 100\nfor f in fonts:\n fnt = ImageFont.truetype(f[1], 40)\n text = \'\xd7\xa2\xd6\xb8\xd7\x9c\xd6\xb5\xd7\x99\xd7\xa0\xd7\x95\xd6\xbc\'\n text_bidi = get_display(text, base_dir=\'R\')\n draw.text((100, height), f[0], font=fnt, fill=(255, 255, 255))\n draw.text((500, height), text_bidi, font=fnt, fill=(255, 255, 255))\n …Run Code Online (Sandbox Code Playgroud)