| 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"> DEFINE</FONT><FONT color="#007700">
|
|
|
33 |
(</FONT><FONT color="#DD0000">"TTF_DIR"</FONT><FONT color="#007700">,</FONT><FONT
|
|
|
34 |
color="#DD0000">"/usr/X11R6/lib/X11/fonts/truetype/"</FONT><FONT color="#007700">
|
|
|
35 |
);
|
|
|
36 |
<BR>
|
|
|
37 |
<BR></FONT><FONT color="#0000BB">$im </FONT><FONT color="#007700">= </FONT><FONT
|
|
|
38 |
color="#0000BB">imagecreatetruecolor </FONT><FONT color="#007700">(</FONT><FONT
|
|
|
39 |
color="#0000BB">400</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
40 |
100</FONT><FONT color="#007700">);
|
|
|
41 |
<BR></FONT><FONT color="#0000BB">$black </FONT><FONT color="#007700">= </FONT><FONT
|
|
|
42 |
color="#0000BB">imagecolorallocate </FONT><FONT color="#007700">(</FONT><FONT
|
|
|
43 |
color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
44 |
0</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">0</FONT><FONT
|
|
|
45 |
color="#007700">, </FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">
|
|
|
46 |
);
|
|
|
47 |
<BR></FONT><FONT color="#0000BB">$white </FONT><FONT color="#007700">= </FONT><FONT
|
|
|
48 |
color="#0000BB">imagecolorallocate </FONT><FONT color="#007700">(</FONT><FONT
|
|
|
49 |
color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
50 |
255</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONT
|
|
|
51 |
color="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONT color="#007700">
|
|
|
52 |
);
|
|
|
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">);
|
|
|
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">);
|
|
|
66 |
<BR>
|
|
|
67 |
<BR></FONT><FONT color="#0000BB">imagettftext </FONT><FONT color="#007700">
|
|
|
68 |
(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT
|
|
|
69 |
color="#0000BB">30</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">
|
|
|
70 |
0</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">10</FONT><FONT
|
|
|
71 |
color="#007700">, </FONT><FONT color="#0000BB">40</FONT><FONT color="#007700">
|
|
|
72 |
, </FONT><FONT color="#0000BB">$black</FONT><FONT color="#007700">, </FONT><FONT
|
|
|
73 |
color="#0000BB">TTF_DIR</FONT><FONT color="#007700">.</FONT><FONT color="#DD0000">
|
|
|
74 |
"arial.ttf"</FONT><FONT color="#007700">, </FONT><FONT color="#DD0000">
|
|
|
75 |
"Hello World!"</FONT><FONT color="#007700">);
|
|
|
76 |
<BR>
|
|
|
77 |
<BR></FONT><FONT color="#0000BB">header </FONT><FONT color="#007700">(</FONT><FONT
|
|
|
78 |
color="#DD0000">"Content-type: image/png"</FONT><FONT color="#007700">
|
|
|
79 |
);
|
|
|
80 |
<BR></FONT><FONT color="#0000BB">imagepng </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 "Hello World!" 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>
|