This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/includes/jpgraph/docs/chunkhtml/example_src/checkttf.html
2011-05-28 19:51:52 +10:00

45 lines
6.3 KiB
HTML

<div style="font-weight: bold;margin-left:15px;">checkttf.php</div><link rel="stylesheet" href="../phphl.css" type="text/css"><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code"> </span><span class="hl-comment">//</span><span class="hl-comment"> content=&quot;text/plain; charset=utf-8&quot;</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> Change this defines to where Your fonts are stored</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">DEFINE</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">TTF_DIR</span><span class="hl-quotes">&quot;</span><span class="hl-code">,</span><span class="hl-quotes">&quot;</span><span class="hl-string">/usr/share/fonts/truetype/</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Change this define to a font file that You know that You have</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">DEFINE</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">TTF_FONTFILE</span><span class="hl-quotes">&quot;</span><span class="hl-code">,</span><span class="hl-quotes">&quot;</span><span class="hl-string">arial.ttf</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Text to display</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-reserved">DEFINE</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">TTF_TEXT</span><span class="hl-quotes">&quot;</span><span class="hl-code">,</span><span class="hl-quotes">&quot;</span><span class="hl-string">Hello World!</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$im</span><span class="hl-code"> = </span><span class="hl-identifier">imagecreatetruecolor</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-number">400</span><span class="hl-code">, </span><span class="hl-number">100</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$white</span><span class="hl-code"> = </span><span class="hl-identifier">imagecolorallocate</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-var">$im</span><span class="hl-code">, </span><span class="hl-number">255</span><span class="hl-code">, </span><span class="hl-number">255</span><span class="hl-code">, </span><span class="hl-number">255</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$black</span><span class="hl-code"> = </span><span class="hl-identifier">imagecolorallocate</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-var">$im</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$border_color</span><span class="hl-code"> = </span><span class="hl-identifier">imagecolorallocate</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-var">$im</span><span class="hl-code">, </span><span class="hl-number">50</span><span class="hl-code">, </span><span class="hl-number">50</span><span class="hl-code">, </span><span class="hl-number">50</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">imagefilledrectangle</span><span class="hl-brackets">(</span><span class="hl-var">$im</span><span class="hl-code">,</span><span class="hl-number">0</span><span class="hl-code">,</span><span class="hl-number">0</span><span class="hl-code">,</span><span class="hl-number">399</span><span class="hl-code">,</span><span class="hl-number">99</span><span class="hl-code">,</span><span class="hl-var">$white</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">imagerectangle</span><span class="hl-brackets">(</span><span class="hl-var">$im</span><span class="hl-code">,</span><span class="hl-number">0</span><span class="hl-code">,</span><span class="hl-number">0</span><span class="hl-code">,</span><span class="hl-number">399</span><span class="hl-code">,</span><span class="hl-number">99</span><span class="hl-code">,</span><span class="hl-var">$border_color</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">imagettftext</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-var">$im</span><span class="hl-code">, </span><span class="hl-number">30</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-number">90</span><span class="hl-code">, </span><span class="hl-number">60</span><span class="hl-code">, </span><span class="hl-var">$black</span><span class="hl-code">, </span><span class="hl-identifier">TTF_DIR</span><span class="hl-code">.</span><span class="hl-identifier">TTF_FONTFILE</span><span class="hl-code">,</span><span class="hl-identifier">TTF_TEXT</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">header</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">Content-type: image/png</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">imagepng</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-var">$im</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div>