Asperon Posted August 23, 2007 Share Posted August 23, 2007 in my php script I have a drop down set up to post a selected font and that font reaches into my Font folder and uses that true type font... arial, verdana, and a couple more work, but there are some that don't, I've double checked the spellings and I can't seem to find the problem here is my form select <td><select name="ln1_font"> <option value="Arial">Arial</option> <option value="Book Antiqua">Book Antiqua</option> <option value="Courier New">Courier New</option> <option value="Garamond">Garamond</option> <option value="Georgia">Georgia</option> <option value="Impact">Impact</option> <option value="Times New Roman">Times New Roman</option> <option value="Trebuchet MS">Trebuchet MS</option> <option value="Verdana">Verdana</option> </select></td> and a second one <td><select name="ln2_font"> <option value="Arial">Arial</option> <option value="Book Antiqua">Book Antiqua</option> <option value="Courier New">Courier New</option> <option value="Garamond">Garamond</option> <option value="Georgia">Georgia</option> <option value="Impact">Impact</option> <option value="Times New Roman">Times New Roman</option> <option value="Trebuchet MS">Trebuchet MS</option> <option value="Verdana">Verdana</option> </select></td> and it is requested and used here <?php $bgColor = $_GET['bgColor']; $logo = $_GET['logo']; $ln1[0] = $_GET['ln1_text']; $ln1[1] = $_GET['ln1_font']; //this is the the font request $ln1[2] = $_GET['ln1_size']; $ln1[3] = $_GET['ln1_color']; $ln1[4] = $_GET['ln1_align']; $ln2[0] = $_GET['ln2_text']; $ln2[1] = $_GET['ln2_font']; // second font request $ln2[2] = $_GET['ln2_size']; $ln2[3] = $_GET['ln2_color']; $ln2[4] = $_GET['ln2_align']; //......more code //Line Array // //ln[0] = text //ln[1] = font //ln[2] = size //ln[3] = color //ln[4] = align (text position based on pixel location) // //End Line Array //format line 1 $font = 'c:/windows/fonts/'.$ln1[1].'.ttf'; switch($ln1[3]){ case 'Black' : $color = ImageColorAllocate($im,0,0,0); break; case 'White' : $color = ImageColorAllocate($im,255,255,255); break; case 'Red' : $color = ImageColorAllocate($im,255,0,0); break; case 'Dark Red' : $color = ImageColorAllocate($im,150,0,0); break; case 'Light Green' : $color = ImageColorAllocate($im,0,255,0); break; case 'Green' : $color = ImageColorAllocate($im,0,150,0); break; case 'Dark Green' : $color = ImageColorAllocate($im,0,100,0); break; case 'Blue' : $color = ImageColorAllocate($im,0,0,255); break; case 'Yellow' : $color = ImageColorAllocate($im,255,255,0); break; case 'Cyan' : $color = ImageColorAllocate($im,0,255,255); break; case 'Purple' : $color = ImageColorAllocate($im,150,0,150); break; case 'Violet' : $color = ImageColorAllocate($im,255,0,255); break; case 'Pink' : $color = ImageColorAllocate($im,255,100,255); break; } ImageTTFText($im,$ln1[2],0,$ln1[4],40,$color,$font,$ln1[0]); //format line 2 $font = 'c:/windows/fonts/'.$ln2[1].'.ttf'; Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/ Share on other sites More sharing options...
marcus Posted August 23, 2007 Share Posted August 23, 2007 Are you outputting the data into an image? Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/#findComment-332286 Share on other sites More sharing options...
Asperon Posted August 23, 2007 Author Share Posted August 23, 2007 yes, it outputs as an image Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/#findComment-332288 Share on other sites More sharing options...
marcus Posted August 23, 2007 Share Posted August 23, 2007 Does the path exist? Try using file_exists(); to see if that file even exists. Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/#findComment-332295 Share on other sites More sharing options...
Asperon Posted August 23, 2007 Author Share Posted August 23, 2007 well, I'll try it, some fonts workl some don't, I know they all exist because I checked my fonts folder, but maybe its not a correct path, I'll check with that thanks Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/#findComment-332298 Share on other sites More sharing options...
Asperon Posted August 23, 2007 Author Share Posted August 23, 2007 on the ouput of echo file_exist(path); if the file exists, it ouputs 1 if it doesn't exist is it supposed to output 0 or nothing? Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/#findComment-332309 Share on other sites More sharing options...
marcus Posted August 23, 2007 Share Posted August 23, 2007 Correct. Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/#findComment-332311 Share on other sites More sharing options...
Asperon Posted August 23, 2007 Author Share Posted August 23, 2007 nevermind I figured it out, I checked the poperties of the fonts and the actual path is not always the name displayed on font in the folder. ie Garamond is GARA.ttf Link to comment https://forums.phpfreaks.com/topic/66394-solved-true-type-fonts-not-working/#findComment-332313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.