TrueType Fonts in PHP |
Author: |
Message: |
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
O.P. RE: TrueType Fonts in PHP
look at http://funmail.keystorm.net/MP!/test.php
The code is:
code: <?php
//header("Content-type: image/jpeg");
$im = imagecreate(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// Replace path by your own font path
imagettftext($im, 20, 0, 10, 20, $black, "./fonts/decotype.ttf",
"Testing... Omega: &#937;");
imagejpeg($im, 'test.png');
imagedestroy($im);
?>
<img src=test.png border=1>
(I tried /fonts/decotype.ttf aswell, as stated in the php doc-page you told me)
|
|
02-12-2004 08:47 PM |
|
|
fluffy_lobster
Veteran Member
Posts: -2
Posts: 1391 Reputation: 23
36 / /
Joined: Nov 2002
|
RE: TrueType Fonts in PHP
I just noticed your config sets the fonts path as /usr/include/freetype2 - maybe try adding that before the path? Font files relative to the file you're running should work just as well though
|
|
02-12-2004 08:55 PM |
|
|
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
O.P. RE: TrueType Fonts in PHP
quote: Originally posted by KeyStorm
imagejpeg($im, 'test.png');
This doesn't show anything either...
quote: Originally posted by fluffy_lobster
/usr/include/freetype2
It's unlikely that it works... I don't have privileges to the user-root.
I mean there, which are the fonts installed by default in there by freetype? (I think I read somewhere some fonts were included)
|
|
02-12-2004 09:02 PM |
|
|
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: TrueType Fonts in PHP
quote: when fontfile does not begin with a leading '/', '.ttf' will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.
That tells me this:
For custom fonts relative to the current dir, have a '/' as the first character (get rid of that dot). Otherwise (if you want to use a default font), no slash.
|
|
02-12-2004 09:05 PM |
|
|
fluffy_lobster
Veteran Member
Posts: -2
Posts: 1391 Reputation: 23
36 / /
Joined: Nov 2002
|
RE: TrueType Fonts in PHP
I'm not sure, it might be somewhere on their website at http://www.freetype.org/
Hmm, try uploading my IP sig as a test, to see whether it's a problem on your server or with the font you're trying to use
|
|
02-12-2004 09:09 PM |
|
|
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
O.P. RE: TrueType Fonts in PHP
quote: Originally posted by WDZ
For custom fonts relative to the current dir, have a '/' as the first character (get rid of that dot). Otherwise (if you want to use a default font), no slash.
quote: Originally posted by KeyStorm
(I tried /fonts/decotype.ttf aswell, as stated in the php doc-page you told me)
quote: Originally posted by KeyStorm
which are the fonts installed by default in there by freetype?
Thanks for your help, so far
|
|
02-12-2004 09:34 PM |
|
|
bach_m
Veteran Member
4837 :P
Posts: 2863 Reputation: 7
37 / / –
Joined: Feb 2003
|
RE: TrueType Fonts in PHP
quote: Originally posted by KeyStorm
(I tried /fonts/decotype.ttf aswell, as stated in the php doc-page you told me)
to make it relative to the current point, if ur server is running linux, use ~/path.
thats because of the filesystem linux uses, where the top directory is /, and everything is below thatt (its kinda complicated...)
|
|
02-12-2004 11:37 PM |
|
|
Pages: (2):
« First
«
1
[ 2 ]
Last »
|
|