Jump to content

Arabic text line is to short on image?


shams

Recommended Posts

I use the ar-php library with still gd library to wirte the text on image, some arabic letters has more chars in the above and below, this text lines are too short on image, but other letters without extra chars are in the normal length, this is the code 

<?php
require_once __DIR__.'/../vendor/autoload.php';

use GDText\Box;
use GDText\Color;

require('../I18N/Arabic.php');
$Arabic = new I18N_Arabic('Glyphs');

$box = new Box($im);
$box->setFontFace(__DIR__.'/../fonts/BahijRegular.ttf');
$box->setFontSize(20);
$box->setFontColor(new Color(0 , 0, 0));
// $box->setTextShadow(new Color(0, 0, 0, 50), 0, -2);
$box->setBox(5, 20, 580, 300);
$box->setTextAlign('right', 'top');

$im = imagecreatefromjpeg(__DIR__.'/../img/img.jpeg');

$text = file_get_contents('/home/user/message');
$text = $Arabic->utf8Glyphs($text);
$box->draw($text);

header("Content-type: image/jpeg");
imagejpeg($im);

This is the output of this code:

 

http://ibb.co/ea1sZ5

 

The first five lines are too short while others text is normal length, is it possible to make these lines longer?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.