![]() |
Watermarks (image_lib) for non-latin or special characters - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Watermarks (image_lib) for non-latin or special characters (/showthread.php?tid=6837) |
Watermarks (image_lib) for non-latin or special characters - El Forum - 03-13-2008 [eluser]popovich[/eluser] Hi, thank you, CodeIgniter, that you exist. Now, to the business. I am having problems with generating watermark for special characters, like em-dash —, and cyrillic characters. Sure, I use different fonts for latin/non-latin languages, but it does not help the problem. I have tried to look here http://de2.php.net/imagettftext , however the result had showed no improvement over the CI methods. Any thoughts are greatly appreciated. Watermarks (image_lib) for non-latin or special characters - El Forum - 03-14-2008 [eluser]popovich[/eluser] OK, if the cyrillics seems to be a hard nut to crack, what about special characters? Here are two functions I have found, which are meant to convert the characters. Nothing works, though. Oh, all my php files are saved in utf-8 encoding, the db fields collation (as well as the table itself) is utf8_unicode_ci. Please? Function one. Code: # Function two: Code: function foxy_utf8_to_nce( Watermarks (image_lib) for non-latin or special characters - El Forum - 03-14-2008 [eluser]popovich[/eluser] Quick update. Initially, I was using an OpenType font (UniversStd.otf), which was rendering the em dash as a crossed square. After trying the omnipresent Arial in TrueType format (arial.ttf) and adding Code: html_entity_decode($text); The only thing left — the cyrillics... ps. Does it happen only to me, that after posting to a forum, the solution crystallizes itself in the air before anyone has replied yet? ![]() Watermarks (image_lib) for non-latin or special characters - El Forum - 03-14-2008 [eluser]xwero[/eluser] If you find the solution and you post it others will have less trouble ![]() Watermarks (image_lib) for non-latin or special characters - El Forum - 03-14-2008 [eluser]popovich[/eluser] The solution: - encode everything as UTF-8 (your database table and field); - user a TrueType (.ttf) font; though the freetype documentation states, that Type1 and OpenType can be used, the cyrillic characters will not be found in the font table; however, it works fine with latin characters; - apply html_entity_decode() to be able to display special chars; - triple check what you are testing — from strings you are trying to display to, well, the MVC setup (my case); Cheers. |