Ad Widget

Collapse

UTF8 strings in images

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jarek
    Member
    • May 2005
    • 35

    #1

    UTF8 strings in images

    Hi all!
    If someone has problems with improper rendering of UTF-8 strings in images, here is the solution:
    Replace all occurrences if imagestring with imagettftext :
    i.e. in include/classes.graph.inc.php, replace:

    PHP Code:
    imagestring($this->im$fontnum,$x,1$str $this->GetColor('Dark Red No Alpha')); 
    with:
    PHP Code:
    imagettftext($this->im,
                            
    9,
                            
    0,
                            
    $x,
                            
    13,
                            
    $this->GetColor('Dark Red No Alpha'),
                            
    '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf',
                            
    $str
                    
    ); 
    Of course this assumes that you have proper ttf fonts. This example assumes that you have ttf-dejavu package installed on debian etch.
    Good luck!
Working...