Blame | Letzte Änderung | Log anzeigen | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1"><LINK REL="Start" HREF="index.html"><LINK REL="Contents" HREF="toc.html"><LINK REL="Prev" HREF="471InstallingTrueTypefonts.html"><LINK REL="Next" HREF="473Specifyingfonts.html"><STYLE TYPE="text/css"><!--BODY { font-family: serif }H1 { font-family: sans-serif }H2 { font-family: sans-serif }H3 { font-family: sans-serif }H4 { font-family: sans-serif }H5 { font-family: sans-serif }H6 { font-family: sans-serif }SUB { font-size: smaller }SUP { font-size: smaller }PRE { font-family: monospace }A { text-decoration: none }--></STYLE></HEAD><BODY><A HREF="toc.html">Contents</A><A HREF="471InstallingTrueTypefonts.html">Previous</A><A HREF="473Specifyingfonts.html">Next</A><HR NOSHADE><H3><A NAME="4_7_2">4.7.2 Verifying that the TTF fonts work</A></H3><P> In order to get TTF fonts working with JpGraph you should firstcheck that the following pure GD scripts work correctly. Please adjustthe font path according to your installation.<DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> DEFINE</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"TTF_DIR"</FONT><FONT color="#007700">,</FONT><FONTcolor="#DD0000">"/usr/X11R6/lib/X11/fonts/truetype/"</FONT><FONT color="#007700">); <BR><BR></FONT><FONT color="#0000BB">$im </FONT><FONT color="#007700">= </FONT><FONTcolor="#0000BB">imagecreatetruecolor </FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">400</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">100</FONT><FONT color="#007700">); <BR></FONT><FONT color="#0000BB">$black </FONT><FONT color="#007700">= </FONT><FONTcolor="#0000BB">imagecolorallocate </FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">0</FONT><FONTcolor="#007700">, </FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">); <BR></FONT><FONT color="#0000BB">$white </FONT><FONT color="#007700">= </FONT><FONTcolor="#0000BB">imagecolorallocate </FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONTcolor="#007700">, </FONT><FONT color="#0000BB">255</FONT><FONT color="#007700">); <BR><BR></FONT><FONT color="#0000BB">imagerectangle</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">,</FONT><FONTcolor="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">399</FONT><FONTcolor="#007700">,</FONT><FONT color="#0000BB">99</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$black</FONT><FONT color="#007700">); <BR></FONT><FONT color="#0000BB">imagefilledrectangle</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">,</FONT><FONTcolor="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">399</FONT><FONTcolor="#007700">,</FONT><FONT color="#0000BB">99</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$white</FONT><FONT color="#007700">); <BR><BR></FONT><FONT color="#0000BB">imagettftext </FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$im</FONT><FONT color="#007700">, </FONT><FONTcolor="#0000BB">30</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">0</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">10</FONT><FONTcolor="#007700">, </FONT><FONT color="#0000BB">40</FONT><FONT color="#007700">, </FONT><FONT color="#0000BB">$black</FONT><FONT color="#007700">, </FONT><FONTcolor="#0000BB">TTF_DIR</FONT><FONT color="#007700">.</FONT><FONT color="#DD0000">"arial.ttf"</FONT><FONT color="#007700">, </FONT><FONT color="#DD0000">"Hello World!"</FONT><FONT color="#007700">); <BR><BR></FONT><FONT color="#0000BB">header </FONT><FONT color="#007700">(</FONT><FONTcolor="#DD0000">"Content-type: image/png"</FONT><FONT color="#007700">); <BR></FONT><FONT color="#0000BB">imagepng </FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$im</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P> The above script assumes you have the GD2 library and will create animage with the classical "Hello World!" text printed in black.</P><HR NOSHADE><A HREF="toc.html">Contents</A><A HREF="471InstallingTrueTypefonts.html">Previous</A><A HREF="473Specifyingfonts.html">Next</A></BODY></HTML>