image icon indicating copy to clipboard operation
image copied to clipboard

Arabic Language

Open Araby-Mohamed opened this issue 4 years ago • 2 comments

When you write words in Arabic on the image Characters look sparse and incorrect

Araby-Mohamed avatar Feb 14 '21 03:02 Araby-Mohamed

Download arabic package https://sourceforge.net/projects/i18n-arabic/

and

require('./I18N/Arabic.php');

// Add styled text to image
$TITLE1 = "محمد مصطفي محمد مصطفي محمد مصطفي ";
$Arabic = new I18N_Arabic('Glyphs');
$text1 = new \NMC\ImageWithText\Text($Arabic->utf8Glyphs($TITLE1), 2);
$text1->align = 'right';
$text1->color = 'FFFFFF';
$text1->font = dirname(__FILE__) . '/I18N/DroidNaskh-Bold.ttf';
$text1->lineHeight = 36;
$text1->size = 24;
$text1->startX = 0;
$text1->startY = 0;
$image->addText($text1);

demo (1)

it will work but with biggest text you will get troubles

Tarek-Adra avatar Apr 28 '21 09:04 Tarek-Adra

How Can I Download arabic package https://sourceforge.net/projects/i18n-arabic/ ??

and how to require('./I18N/Arabic.php'); ??

MarioGafeed avatar Sep 07 '22 17:09 MarioGafeed

How Can I Download arabic package https://sourceforge.net/projects/i18n-arabic/ ??

and how to require('./I18N/Arabic.php'); ??

you can use composer, package https://github.com/khaled-alshamaa/ar-php

composer require khaled.alshamaa/ar-php

then

` use ArPHP\I18N\Arabic;

$arabic = new Arabic(); $userName = $arabic->utf8Glyphs('محمد مصطفي محمد مصطفي محمد مصطفي'); `

dev3k avatar Sep 27 '22 14:09 dev3k

The problem is that it only writes first and last letter, the package fixed the order though, but rest of the letters are encrypted IDK why.

ahmed-esmail-1 avatar Mar 17 '24 20:03 ahmed-esmail-1