1

Hay i am trying to use Hindi text in GD Library i call text from array but its Look like something this boxes [] [] [] [] [] [] [] [] [] This is my code have a look this

 header ("Content-type: image/jpg");

 $font='captcha/OpenSans-Regular.ttf';
 $images2='http://graph.facebook.com/'.$user->id.'/picture?width=320'; 
 $images='../../images/news.jpg';
 $im = imagecreatefromjpeg("$images")or die("Cannot Initialize new GD image stream");
 $im2 = imagecreatefromjpeg("$images2")or die("Cannot Initialize new GD image stream");
 $newsText1 = "$user->first_name ने दुनिया को एलियंस से बचाया";
 $newsText2 = "$user->first_name अब नजर आएंगे प्राइम मिनिस्टर की कुदसि पर ";
 $newsText3 = "$user->first_name की निस्क्लि हज़ार करोड़ की लॉटरी";
 $a=array($user1,"$newsText1","$newsText2","$newsText3");
 $random_keys=array_rand($a,3);

 $text=$a[$random_keys[0]];

     $text_color = imagecolorallocate($im,255,255,255); //menentukan warna text

   imagettftext ($im, 35, 0, 200, 550, $text_color, $font, $text);


    imagecopy($final_img, $im, 0, 0, 0, 0, $x, $y);
    imagecopy($final_img, $im2, 130, 115, -10, -10, 330, 330);
      imagejpeg($final_img);
       imagedestroy($final_img);
Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
Riyaz saifi
  • 89
  • 10
  • Does open sans support those characters? As in have you tested it without GD? – PeeHaa Jul 11 '16 at 10:02
  • Yea but there is any way to Use Hindi Characters – Riyaz saifi Jul 11 '16 at 10:03
  • How to allow Hindi characters – Riyaz saifi Jul 11 '16 at 10:04
  • What is that? And how does it relate to my comment? – PeeHaa Jul 11 '16 at 10:05
  • Yea without GD its Work fine – Riyaz saifi Jul 11 '16 at 10:07
  • Yes i was text it without GD its working perfectly fine – Riyaz saifi Jul 11 '16 at 10:10
  • As PeeHaa is trying to point out, OpenSans **does not support Devanagari**. [Here](https://www.google.com/fonts/specimen/Open+Sans) (scroll down) is a table of all glyphs included in OpenSans. –  Jul 11 '16 at 10:11
  • witch font support Hindi Can you Please tell me – Riyaz saifi Jul 11 '16 at 10:17
  • A simple Google query for "OpenType Devanagari" eventually pointed me to [the Chandas and Uttara fonts](http://www.sanskritweb.net/cakram/), but [there are others, such as Sanskrit2003](https://www.quora.com/What-is-the-best-Devanagari-OpenType-font-you-have-come-across). That Quora question also points to [the Indian Type Foundry](https://www.indiantypefoundry.com/), which might also be interesting to check out. –  Jul 11 '16 at 10:22
  • Possible duplicate of [Writing Hindi Fonts with GD Library do not render as desired](https://stackoverflow.com/questions/21188046/writing-hindi-fonts-with-gd-library-do-not-render-as-desired) – Stephen Kennedy Mar 12 '18 at 11:38

0 Answers0