Podaję fonta - arial'a. Tak jak pisałem, php na pewno z niego korzysta, ponieważ process httpd.exe ma do niego uchwyt.
Dawałem też na sztywno tekst, używałem też funkcji iconv(), no i efekt był taki sam.
Poniżej testowty fragment kodu:
$img = new Images;
if(isset($_POST['page_dir'])) {
if($_POST['page_dir'] == 'vertical')
{
$img->width = 194;
$img->height = 274;
$img->pageDirection = 'vertical';
}
}
$img->new_img = @imagecreatetruecolor($img->width, $img->height);
if($img->width>$img->height)
$img->src_img = @imagecreatefrompng('../resource/blank_vertical.png');
else
$img->src_img = @imagecreatefrompng('../resource/blank_horizontal.png');
if($img->new_img && $img->src_img)
{
if(preg_match('/^#[a-zA-Z0-9]{6}$/',$_POST['colorValue'])) {
$img->fontColor = $img->html2rgb($_POST['colorValue']);
}
if(isset($_POST['format_B']) && $_POST['format_B'] == 'bold') {
$img->fontStyle = 'b';
}
if(isset($_POST['format_I']) && $_POST['format_I'] == 'italic') {
$img->fontStyle .= 'i';
}
if($_POST['font'] == 'arial')
$img->fontFile = 'arial'.$img->fontStyle.'.ttf';
else if($_POST['font'] == 'times')
$img->fontFile = 'times'.$img->fontStyle.'.ttf';
else if($_POST['font'] == 'verdana')
$img->fontFile = 'verdana'.$img->fontStyle.'.ttf';
else
$img->fontFile = 'arial'.$img->fontStyle.'.ttf';
if((int)$_POST['font-size-value'] >=10 && (int)$_POST['font-size-value'] <=72)
{
$img->fontSize = $_POST['font-size-value'];
}
if(isset($_POST['text-align']) && $_POST['text-align'] == 'left') $img->textAlign = 'left';
else if(isset($_POST['text-align']) && $_POST['text-align'] == 'right') $img->textAlign = 'right';
else if(isset($_POST['text-align']) && $_POST['text-align'] == 'center') $img->textAlign = 'center';
// $img->userText = explode("\r\n",$_POST['userText']);
$img->userText = $_POST['userText'];
///////////////////////////////////////////////////////////////////////////////////////////////
@imagealphablending($img->new_img, false);
@imagesavealpha($img->new_img, true);
@imagecopy($img->new_img, $img->src_img, 0, 0, 0, 0, $img->width, $img->height);
@imagedestroy($img->src_img);
$img->fnFontColor = @imagecolorallocate($img->new_img, $img->fontColor[0], $img->fontColor[1], $img->fontColor[2]);
@imagettftext($img->new_img, $img->fontSize, 0, 50, 20, $img->fnFontColor, $img->fontFile, $img->userText);
@imagepng($img->new_img,'test.png');
@imagedestroy($img->new_img);