You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Devilbox PHP GD Library is configured with 'JIS-mapped Japanese Font Support: enable'.
It causes an unfixable bug with char detection and Cyrillic letters used in imagettftext() and imagettfbbox().
Adding double conversion with mb_convert_encoding( $text, "SJIS", "UTF-8" ); is not a valuable option because it's not working as one would expect. It can convert about 85% letters but not all. Also double conversion is not optimal.
I heard that GD devs are a long time aware of this bug but it still exists.
Right now if someone uses Devilbox to run a project which relies on imagettftext() + Cyrillic letters it will not work.
It can be fixed by adding an option to disable this GD setting completely. Probably a special PHP image where PHP/GD will be built with configure --disable-gd-jis-conv?
STEPS TO REPRODUCE
Install Devilbox as always.
Check phpinfo(). Expect to see JIS-mapped Japanese Font Support: enable in GD section.
Create and run a php script:
Use font PtSans (ttf can be downloaded from Google Fonts) as a font with Cyrillics support
Use https://www.php.net/manual/ru/function.imagettfbbox.php
$text_box = imagettfbbox( $fontSize, 0, $font, 'текст на русском языке не работает' );
The same steps are valid for imagettftext();
EXPECTED BEHAVIOUR
Be able to use imagettftext();
ACTUAL BEHAVIOUR
Warning: imagettftext() [function.imagettftext]: any2eucjp(): invalid code in input string
The text was updated successfully, but these errors were encountered:
ISSUE TYPE
OS / ENVIRONMENT
SUMMARY
In the Devilbox PHP GD Library is configured with 'JIS-mapped Japanese Font Support: enable'.
It causes an unfixable bug with char detection and Cyrillic letters used in imagettftext() and imagettfbbox().
Adding double conversion with mb_convert_encoding( $text, "SJIS", "UTF-8" ); is not a valuable option because it's not working as one would expect. It can convert about 85% letters but not all. Also double conversion is not optimal.
I heard that GD devs are a long time aware of this bug but it still exists.
Right now if someone uses Devilbox to run a project which relies on imagettftext() + Cyrillic letters it will not work.
It can be fixed by adding an option to disable this GD setting completely. Probably a special PHP image where PHP/GD will be built with configure --disable-gd-jis-conv?
STEPS TO REPRODUCE
Check phpinfo(). Expect to see JIS-mapped Japanese Font Support: enable in GD section.
Use font PtSans (ttf can be downloaded from Google Fonts) as a font with Cyrillics support
Use https://www.php.net/manual/ru/function.imagettfbbox.php
$text_box = imagettfbbox( $fontSize, 0, $font, 'текст на русском языке не работает' );
The same steps are valid for imagettftext();
EXPECTED BEHAVIOUR
Be able to use imagettftext();
ACTUAL BEHAVIOUR
Warning: imagettftext() [function.imagettftext]: any2eucjp(): invalid code in input string
The text was updated successfully, but these errors were encountered: