title: Adding text to image with PHP GD
body: <p>I am trying to add a hindi text to an image using PHP GD and the text is being converted to squares, I think this is happening, php gd is not supporting hindi text. </p>
  
  <p>Please tell me how to solve this issue or is there any other way to add hindi text to an Image.</p>
  
  <p>This is the code I am using:</p>
  
  <pre><code>  //Set the Content Type
    header('Content-type: image/jpeg');
  
    // Create Image From Existing File
    $jpg_image = imagecreatefromjpeg('temp/mango.jpg');
  
    // Allocate A Color For The Text
    $white = imagecolorallocate($jpg_image, 255, 255, 255);
    $black = imagecolorallocate($jpg_image, 0,0,0);
  
    $font = dirname(__FILE__) . '/font/opensans.ttf';
  
    // Set Text to Be Printed On Image
  
    // Print Text On Image
    imagettftext($jpg_image, 25, 0, 75, 300, $white, $font, "आम फलो का राजा है। ");
  
  
  
  
    // Send Image to Browser
    imagejpeg($jpg_image);
  
    // Clear Memory
    imagedestroy($jpg_image);
  </code></pre>
  
  <p>Result I am Getting :</p>
  
  <p><a href="https://i.stack.imgur.com/tcUOK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tcUOK.jpg" alt="enter image description here"></a></p>