image icon indicating copy to clipboard operation
image copied to clipboard

Option to add utf-8 characters on image

Open Satendra-SR opened this issue 5 years ago • 9 comments

Can we have an option for utf-8 characters May be something like $font->encode('utf-8');.

$img->text('foo', 0, 0, function($font) {
    $font->encode('utf-8');
});

Currently, it is not supporting these characters.

I have tested it with following fonts

  1. Arial unicode ms
  2. Devanagari
  3. Noto_Sans

All the above fonts supports hindi language

This is the expected result In Indian (Hindi) language.

इण्टरनेट पर हिन्दी के साधन

This is how it getting rendered image

Satendra-SR avatar May 01 '19 09:05 Satendra-SR

I faced the exact same issue. This is too frustrating and needs an urgent fix. Can anyone tell me what's going on here? Or if this is not the right place where should this be reported?

pokhiii avatar May 01 '19 11:05 pokhiii

me too facing the same issue, please provide a fix asap

msamgan avatar May 31 '19 11:05 msamgan

It seems like the language is supported but you have to select a font which supports both the languages.

msamgan avatar Jun 09 '19 05:06 msamgan

There are same problem in Turkish characters. For example, it's writing '& U u m l ;' instead of 'Ü' Screenshot from 2020-02-14 08-12-52

huseyinerbayat avatar Feb 14 '20 05:02 huseyinerbayat

There are same problem in Turkish characters. For example, it's writing "Ü" instead of 'Ü'

This problem in my server. It's running in my localhost. Why can be?

huseyinerbayat avatar Feb 14 '20 05:02 huseyinerbayat

I am going to +1 this issue. It would be nice to be able to use UTF-8 character.

As you can see I am missing UTF-8 characters below:

Original image

Using Intervention: image

james090500 avatar May 10 '20 21:05 james090500

I ended up with sort of a solution. I used preg_match('/([^\x00-\x7F]+)/u', $msg) to see if the character was unicode. If it was I used a different font to render. I recommend this font: https://fontlibrary.org/en/font/gnu-unifont

as you can see unicode blocks/symbols are rendering: image

image

james090500 avatar May 12 '20 22:05 james090500

Hi Author,

Can we please find a solution for this issue?

codernik avatar Feb 18 '22 19:02 codernik

same issue, any help

ankitsinghmyself avatar Apr 13 '22 16:04 ankitsinghmyself

I have checked this again with the current version 3. Maybe someone can help me, as I can't see a problem at the moment.

As long as the font supports the character, the result is rendered correctly in my opinion.

$text = "इण्टरनेट पर हिन्दी के साधन";
$image->text($text, 100, 100, function ($font) {
    $font->filename('./ArialUnicodeMS.ttf');
    $font->size(32);
});

Result Image

Bildschirmfoto 2023-12-09 um 10 46 16

Have I overlooked something here?

olivervogel avatar Dec 09 '23 09:12 olivervogel