I'm using Intervention Library for laravel with imagick. it doesn't render Hindi fonts correctly.
For example:
"इण्टरनेट पर हिन्दी के साधन" is getting rendered as
Here is my code. I'm using Arial-unicode-ms font
public static function generateOverlayText($image, $text)
{
$img = Image::make($image->getContent());
$extension = 'jpg';
$centerX = 25;
$centerY = 210;
$lines = explode("\n", wordwrap($text, 21));
$currentLineVIndex = $centerY;
foreach ($lines as $line) {
$img->text($line, $centerX, $currentLineVIndex, function ($font) use ($fontSize) {
$font->file(public_path('fonts/arial-unicode-ms/arial-uni.ttf'));
$font->size(18);
$font->color('#fdf6e3');
});
}
$encoded = $img->encode($extension);
return $encoded;
}
Can we do something to render it correctly? Thanks for the help