Sybio/ImageWorkshop

Can't display Kannada(india language)

Closed this issue · 8 comments

issl commented

Hello,
I can't display Kannada text in initTextLayer ( ex : ಟೆಸ್ಟ್).
It's encoded in utf-8.

How can I display india language?

Hi issl,

Can you give me the code you use ?

utf-8 characters aren't displayed correctly ! this code shows a rectangle instead of the heart symbol !
code:

$text = '❤';
$width = 300;
$height = 200;
$backgroundColor = 'FFFFFF'; // optionnal, can be null to transparent 
$imageLayer = ImageWorkshop::initVirginLayer($width, $height, $backgroundColor);
$fontPath = "fonts/arial.ttf";
$fontSize = 12;
$fontColor = "000000";
$textRotation = 0;
$backgroundColor = null; // optionnal
$textLayer = ImageWorkshop::initTextLayer($text, $fontPath, $fontSize, $fontColor, $textRotation, $backgroundColor);
$positionX = 80; // Left position in px
$positionY = 40; // top position in px
$position = "LB";
$imageLayer->addLayerOnTop($textLayer, $positionX, $positionY, $position);
$dirPath = './';
$filename = "utf8Chars.jpeg";
$createFolders = true;
$backgroundColor = null; // transparent, only for PNG (otherwise it will be white if set null)
$imageQuality = 95; // useless for GIF, usefull for PNG and JPEG (0 to 100%)
$imageLayer->save($dirPath, $filename, $createFolders, $backgroundColor, $imageQuality);

check the image 'utf8Chars.jpeg' at the same directory of the script

hi there, it's me again, after poking around I found that the problem is in the font file not in the library :) try working with a pan-unicode font, this type of fonts has all possible characters so it's (remarquably) has a larger file size ;) but at least solves the utf-8 characters.

Hey, i'm happy you find your solution :)

Thanks for your feedback.

;)

And thanks for using our lib.

you're very welcome, your library rocks :) and I'm currently using it for my computer science final year project ;)

👍