Jump to content

[SOLVED] true type fonts not working


Asperon

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.