大家好,我是新来的,我的英语不好,对不起。
我的imagettfstring
起始位置有问题,阿拉伯语是从右到左,所以我在将阿拉伯语保留在自定义位置时遇到问题,例如距离右侧50px。
试着展示我对图片的意思:
我希望底部的红色文字从右边开始,如果可能的话,文字是从左到右开始,有没有办法将黑线粘在白线上? 我希望当文字变得更大时,用棕色箭头方向
我正在使用的代码:
<?php
require_once("image.php");
$image = new image;
if (isset($_REQUEST["name"])) {
$image -> createFromFile(1, "gbg.png");
$c = $image -> arabttfBox(45, 0, "andlso.ttf", $_REQUEST["name"]);
$image -> arabttfString(1, $c[0], "andlso.ttf", 45, "#F00", 0, 0 , 100);
$image -> arabttfString(1, $_REQUEST["name"], "andlso.ttf", 45, "#F00",
0, 0 , 520);
$image -> display(1, "png");
} else {
$image -> create("error", 400, 100, "#333");
$image -> border("error", "#000", "3");
$image -> string("error", "Post a name", 5, "#F00", 10, 10, true, true);
$image -> display("error", "png");
}
?>
图片:
阿拉伯语文本,如果你想复制:
سمرعلي
如果您要我上传字体,请告诉我。
经过一番思考,我已经解决了这个问题:list($IW, $IH) = $this -> dimensions($ID);
list($FW, $FH) = $this -> arabttfBox($Size, $Angle, $Font, fagd($string));
return imagettftext($this -> image[$ID], $Size, $Angle, $IW-$FW-$X, $Y,
imagecolorallocate($this -> image[$ID], $R, $G, $B),
$Font, fagd($string));
答案 0 :(得分:1)
解决方案:
list($IW, $IH) = $this -> dimensions($ID);
list($FW, $FH) = $this -> arabttfBox($Size, $Angle, $Font, fagd($string));
return imagettftext($this -> image[$ID], $Size, $Angle, $IW-$FW-$X, $Y,
imagecolorallocate($this -> image[$ID], $R, $G, $B),
$Font, fagd($string));