stil / gd-text

PHP class making it easy to type text on pictures. Supports multi-lined text, horizontal and vertical alignment.
400 stars 131 forks source link

Set 2 fonts with different text in the same draw function? #54

Open CristJian opened 4 years ago

CristJian commented 4 years ago

Hi, how can I display 2 different fonts in the same text separated by a new line?

$font1 = "font1.ttf"; $font2 = "font2.ttf"; $text1 = "text"; $text2 = "text2";

$box = new Box($im); $box->setFontFace($font1); $box->setFontColor(new Color(255, 255, 255)); $box->setTextShadow(new Color(0, 0, 0, 50), 2, 2); $box->setFontSize(35); $box->setBox(100, 150, 500, 400); $box->setTextAlign('center', 'center'); $box->draw($text1."\n".$text2); // here only displays the second text with the font1