I have this code, but my problem is that the starting point from left to right as in English, and I got no clue how to make it RTL
here's my code:
$test = "بسم الله الرحمن الرحيم";
$test = $Arabic->utf8Glyphs($test);
$test= $test;
$angle = 0;
$font_size =40;
// Get image dimensions
$width = imagesx($jpg_image);
$height = imagesy($jpg_image);
// Get center coordinates of image
$centerX = $width / 2;
$centerY = $height / 2;
// Get size of text
list($left, $bottom, $right, , , $top) = imageftbbox($font_size, $angle, $font_path, $test);
$left_offset = ($right - $left) / 2;
$top_offset = ($bottom - $top) / 2;
$x = $centerX - $left_offset;
$y = $centerY - $top_offset;
imagettftext($jpg_image, $font_size, $angle, $x + 950, 665, $color, $font_path, $test);