Watermarks (image_lib) for non-latin or special characters |
[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.
[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(
[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? ![]()
[eluser]xwero[/eluser]
If you find the solution and you post it others will have less trouble ![]()
[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. |
Welcome Guest, Not a member yet? Register Sign In |