source: trunk/xgraph/jpgraph/Examples/checkttf.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 736 bytes
Line 
1<?php // content="text/plain; charset=utf-8"
2// Change this defines to where Your fonts are stored
3DEFINE("TTF_DIR","/usr/share/fonts/truetype/");
4
5// Change this define to a font file that You know that You have
6DEFINE("TTF_FONTFILE","arial.ttf");
7
8// Text to display
9DEFINE("TTF_TEXT","Hello World!");
10
11$im = imagecreatetruecolor (400, 100);
12$white = imagecolorallocate ($im, 255, 255, 255);
13$black = imagecolorallocate ($im, 0, 0, 0);
14$border_color = imagecolorallocate ($im, 50, 50, 50);
15
16imagefilledrectangle($im,0,0,399,99,$white);
17imagerectangle($im,0,0,399,99,$border_color);
18imagettftext ($im, 30, 0, 90, 60, $black, TTF_DIR.TTF_FONTFILE,TTF_TEXT);
19
20header ("Content-type: image/png");
21imagepng ($im);
22?>
Note: See TracBrowser for help on using the repository browser.