Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2
<HTML>
3
<HEAD>
4
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
5
<LINK REL="Start" HREF="index.html">
6
<LINK REL="Contents" HREF="toc.html">
7
<LINK REL="Prev" HREF="471InstallingTrueTypefonts.html">
8
<LINK REL="Next" HREF="473Specifyingfonts.html">
9
<STYLE TYPE="text/css"><!--
10
BODY { font-family: serif }
11
H1 { font-family: sans-serif }
12
H2 { font-family: sans-serif }
13
H3 { font-family: sans-serif }
14
H4 { font-family: sans-serif }
15
H5 { font-family: sans-serif }
16
H6 { font-family: sans-serif }
17
SUB { font-size: smaller }
18
SUP { font-size: smaller }
19
PRE { font-family: monospace }
20
A { text-decoration: none }
21
--></STYLE>
22
</HEAD>
23
<BODY>
24
<A HREF="toc.html">Contents</A>
25
<A HREF="471InstallingTrueTypefonts.html">Previous</A>
26
<A HREF="473Specifyingfonts.html">Next</A>
27
<HR NOSHADE>
28
<H3><A NAME="4_7_2">4.7.2 Verifying that the TTF fonts work</A></H3>
29
<P> In order to get TTF fonts working with JpGraph you should first
30
 check that the following pure GD scripts work correctly. Please adjust
31
 the font path according to your installation.<DIV class="phpscript"><CODE>
32
<FONT color="#000000"> <FONT color="#0000BB">&nbsp;DEFINE</FONT><FONT color="#007700">
33
(</FONT><FONT color="#DD0000">&quot;TTF_DIR&quot;</FONT><FONT color="#007700">,</FONT><FONT
34
color="#DD0000">&quot;/usr/X11R6/lib/X11/fonts/truetype/&quot;</FONT><FONT color="#007700">
35
);&nbsp;
36
<BR>
37
<BR></FONT><FONT color="#0000BB">$im&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
38
color="#0000BB">imagecreatetruecolor&nbsp;</FONT><FONT color="#007700">(</FONT><FONT
39
color="#0000BB">400</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">
40
100</FONT><FONT color="#007700">);&nbsp;
41
<BR></FONT><FONT color="#0000BB">$black&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
42
color="#0000BB">imagecolorallocate&nbsp;</FONT><FONT color="#007700">(</FONT><FONT
43
color="#0000BB">$im</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">
44
0</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">0</FONT><FONT
45
color="#007700">,&nbsp;</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">
46
);&nbsp;
47
<BR></FONT><FONT color="#0000BB">$white&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT
48
color="#0000BB">imagecolorallocate&nbsp;</FONT><FONT color="#007700">(</FONT><FONT
49
color="#0000BB">$im</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">
50
255</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">255</FONT><FONT
51
color="#007700">,&nbsp;</FONT><FONT color="#0000BB">255</FONT><FONT color="#007700">
52
);&nbsp;
53
<BR>
54
<BR></FONT><FONT color="#0000BB">imagerectangle</FONT><FONT color="#007700">
55
(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">,</FONT><FONT
56
color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
57
0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">399</FONT><FONT
58
color="#007700">,</FONT><FONT color="#0000BB">99</FONT><FONT color="#007700">
59
,</FONT><FONT color="#0000BB">$black</FONT><FONT color="#007700">);&nbsp;
60
<BR></FONT><FONT color="#0000BB">imagefilledrectangle</FONT><FONT color="#007700">
61
(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">,</FONT><FONT
62
color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">
63
0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">399</FONT><FONT
64
color="#007700">,</FONT><FONT color="#0000BB">99</FONT><FONT color="#007700">
65
,</FONT><FONT color="#0000BB">$white</FONT><FONT color="#007700">);&nbsp;
66
<BR>
67
<BR></FONT><FONT color="#0000BB">imagettftext&nbsp;</FONT><FONT color="#007700">
68
(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">,&nbsp;</FONT><FONT
69
color="#0000BB">30</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">
70
0</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#0000BB">10</FONT><FONT
71
color="#007700">,&nbsp;</FONT><FONT color="#0000BB">40</FONT><FONT color="#007700">
72
,&nbsp;</FONT><FONT color="#0000BB">$black</FONT><FONT color="#007700">,&nbsp;</FONT><FONT
73
color="#0000BB">TTF_DIR</FONT><FONT color="#007700">.</FONT><FONT color="#DD0000">
74
&quot;arial.ttf&quot;</FONT><FONT color="#007700">,&nbsp;</FONT><FONT color="#DD0000">
75
&quot;Hello&nbsp;World!&quot;</FONT><FONT color="#007700">);&nbsp;
76
<BR>
77
<BR></FONT><FONT color="#0000BB">header&nbsp;</FONT><FONT color="#007700">(</FONT><FONT
78
color="#DD0000">&quot;Content-type:&nbsp;image/png&quot;</FONT><FONT color="#007700">
79
);&nbsp;
80
<BR></FONT><FONT color="#0000BB">imagepng&nbsp;</FONT><FONT color="#007700">(</FONT><FONT
81
color="#0000BB">$im</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB">
82
</FONT></FONT></CODE></DIV></P>
83
<P> The above script assumes you have the GD2 library and will create an
84
 image with the classical &quot;Hello World!&quot; text printed in black.</P>
85
<HR NOSHADE>
86
<A HREF="toc.html">Contents</A>
87
<A HREF="471InstallingTrueTypefonts.html">Previous</A>
88
<A HREF="473Specifyingfonts.html">Next</A>
89
</BODY>
90
</HTML>