image
image copied to clipboard
Arabic Language
When you write words in Arabic on the image Characters look sparse and incorrect
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);
it will work but with biggest text you will get troubles
How Can I Download arabic package https://sourceforge.net/projects/i18n-arabic/ ??
and how to require('./I18N/Arabic.php'); ??
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('محمد مصطفي محمد مصطفي محمد مصطفي'); `
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.