ID: 26901 Updated by: [EMAIL PROTECTED] Reported By: jpg at pmers dot net -Status: Feedback +Status: Bogus Bug Type: GD related Operating System: Linux PHP Version: 4.3.4 New Comment:
Some notes about using non-ASCII characters with GD extension: 1. Don't enable --enable-gd-jis-conv if you don't really understand what you are doing. The option is only meaningful when it comes to handling Japanese texts. Please refer to the relevant documentation included in the GD library distribiton. 2. The FreeType2 library which is used by GD to render a bitmap with a given TTF file always assumes the input string to be encoded in UTF-8. This means passing strings of another encoding (character set) doesn't make any sense and it will most likely end up with a bunch of square placeholders. Thus you have to encode strings by UTF-8 before passing it to ImageTTFText(). 3. Make sure that you are using a correct TTF file whose glyphs are correctly mapped to the character set by which the string you want to rasterlize is represented. If it doesn't match, rendering will silently fail. 4. utf8_encode() can only handle the ISO-8859-1 character set, where the character set that is most commonly used in Czech texts is ISO-8859-2. Use mb_convert_encoding() or iconv() instead. Previous Comments: ------------------------------------------------------------------------ [2004-01-16 09:12:35] [EMAIL PROTECTED] Provide the script downloadadble somewhere. ------------------------------------------------------------------------ [2004-01-15 06:37:06] jpg at pmers dot net I'm not sure if I understand what you mean, I have added the following code: setlocale(LC_ALL, 'cs_CZ'); Doesn't make any difference. ------------------------------------------------------------------------ [2004-01-14 19:48:10] [EMAIL PROTECTED] Have you tried exporting Czech locale before creating the image? ------------------------------------------------------------------------ [2004-01-14 11:08:45] jpg at pmers dot net example output: http://ccres.net/char_test.php ------------------------------------------------------------------------ [2004-01-14 09:54:19] jpg at pmers dot net <?php $im = imagecreate(450,200); if ($im=="") { die("Error creating image"); } $bg_color = imagecolorallocate ($im, 255, 255, 255); $black = imagecolorallocate($im,0,0,0); $ttf_tahoma = "[your_path]/ttf/tahoma.ttf"; // edit this imagettftext($im, 11, 0, 10, 20, $black, $ttf_tahoma, "Example of chars are: š and ž (Czech language)"); ImagePNG($im); ImageDestroy($im); ?> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/26901 -- Edit this bug report at http://bugs.php.net/?id=26901&edit=1