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?

Edited by shams
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.