seanmt Posted February 11, 2010 Share Posted February 11, 2010 I recently moved servers and since then I have noticed that one line of text is showing weirdly. I have attached an example image that was generated. In the word 'Managing' the letters M & N are being distorted. The bit of code that creates that line of text is... $silk = 'fonts/slkscr.ttf'; $grey = imagecolorallocate($im, 49, 51, 61); imagefttext($im, 6, 0, 73, 25, $grey, $silk, 'Managing'); [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/ Share on other sites More sharing options...
sader Posted February 11, 2010 Share Posted February 11, 2010 It looks like font is not found and some default font(depends of the server) is assigned u have font in that directory? also u may try change font path to full path something like $silk = '/host/host_suer_name/public_html/fonts/slkscr.ttf'; u can find this prefix by echoing $_SERVER['DOCUMENT_ROOT'] Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1011062 Share on other sites More sharing options...
seanmt Posted February 12, 2010 Author Share Posted February 12, 2010 The font definitely exists. I just deleted them from the server and all the bits of text that use that font disappeared completely. Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1011089 Share on other sites More sharing options...
teamatomic Posted February 12, 2010 Share Posted February 12, 2010 Thats how the font is supposed to look. Its kinda ugly if you ask me. HTH Teamatomic [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1011231 Share on other sites More sharing options...
seanmt Posted February 12, 2010 Author Share Posted February 12, 2010 Thats how the font is supposed to look. Its kinda ugly if you ask me. HTH Teamatomic It doesn't. Like I say i used it for months before hand. It only started looking like that when I changed server. I have it on my PC and here is what it looks like... [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1011360 Share on other sites More sharing options...
seanmt Posted February 14, 2010 Author Share Posted February 14, 2010 Any other ideas as to why it doesn't display correctly? Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1011971 Share on other sites More sharing options...
sader Posted February 14, 2010 Share Posted February 14, 2010 Font size may cause it. The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2). So it probably server uses another GD version Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1011981 Share on other sites More sharing options...
seanmt Posted February 14, 2010 Author Share Posted February 14, 2010 Font size may cause it. The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2). So it probably server uses another GD version I think that could be it. Except I have tried loads of different font sizes but to no avail. They all have the weird shaped M & N's. I have given up and resorted to using a different font now. Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1012069 Share on other sites More sharing options...
salathe Posted February 14, 2010 Share Posted February 14, 2010 Can you recreate this with a basic image? E.g. does the following still produce the mangled letters? <?php $im = imagecreatetruecolor(100, 50); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 49, 51, 61); imagefill($im, 0, 0, $white); imagerectangle($im, 0, 0, 99, 49, $grey); $silk = 'fonts/slkscr.ttf'; imagettftext($im, 6, 0, 25, 22, $grey, $silk, 'Managing'); imagettftext($im, 6, 0, 25, 32, $grey, $silk, '(GD '.GD_VERSION.')'); header('Content-Type: image/png'); imagepng($im); exit; Also where did you get the font file from, did you use the one from kottke.org? Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1012075 Share on other sites More sharing options...
seanmt Posted February 18, 2010 Author Share Posted February 18, 2010 Can you recreate this with a basic image? E.g. does the following still produce the mangled letters? Yes it does (see attachment). Also where did you get the font file from, did you use the one from kottke.org? Yes I believe so. It's been on my computer a long time now though so I am not 100% sure. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/191825-text-not-displaying-correctly-with-phpgd/#findComment-1014443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.