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/ch08s06.html

42 lines
5.2 KiB
HTML
Raw Permalink Normal View History

2011-05-28 09:51:52 +00:00
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Adding custom TTF fonts</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="ch08.html" title="Chapter 8. Text and font handling"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding custom TTF fonts</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Chapter 8. Text and font handling</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="sect1" title="Adding custom TTF fonts"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.adding-custom-ttf-fonts"></a>Adding custom TTF fonts</h2></div></div></div>
<p>In addition to the predefined fonts it is possible to easily use up to three
custom fonts. This is done by first specifying the name of the font file that should
be used and then specifying the font family as either <code class="code">FF_USERFONT1</code>,
<code class="code">FF_USERFONT2</code> or <code class="code">FF_USERFONT3</code>. A new font is installed
by calling one or more of the methods</p>
<p>
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p><code class="code">Graph::SetUserFont1($aNormal,$aBold,$aItalic,$aBoldIt)</code>
(or the synonym <code class="code">SetUserFont()</code> )</p>
</li><li class="listitem">
<p><code class="code">Graph::SetUserFont2($aNormal,$aBold,$aItalic,$aBoldIt)</code></p>
</li><li class="listitem">
<p><code class="code">Graph::SetUserFont3($aNormal,$aBold,$aItalic,$aBoldIt)</code></p>
</li></ul></div><p>
</p>
<p>The argument to these methods should be the full font file name (including full
path) for the normal, bold, italic and/or bolditalic variant of the font family. All
arguments apart from "<code class="code">$aNormal</code>" are optional. </p>
<p>An example on how this can be used to use a special font for the title of a graph
is shown in
<a class="xref" href="ch08s06.html#ex.user-font-ex1" title="Example 8.1. Specifying and installing a user specified font">Example 8.1. Specifying and installing a user specified font</a></p>
<div class="example"><a name="ex.user-font-ex1"></a><p class="title"><b>Example 8.1. Specifying and installing a user specified font</b></p><div class="example-contents">
<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
</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"> ...</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$graph</span><span class="hl-code">-&gt;</span><span class="hl-identifier">SetUserFont</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">/usr/share/fonts/ttf/digital.ttf</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$graph</span><span class="hl-code">-&gt;</span><span class="hl-identifier">title</span><span class="hl-code">-&gt;</span><span class="hl-identifier">SetFont</span><span class="hl-brackets">(</span><span class="hl-identifier">FF_USERFONT</span><span class="hl-code">,</span><span class="hl-identifier">FS_NORMAL</span><span class="hl-code">,</span><span class="hl-number">12</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$graph</span><span class="hl-code">-&gt;</span><span class="hl-identifier">title</span><span class="hl-code">-&gt;</span><span class="hl-identifier">Set</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">Test title </span><span class="hl-quotes">'</span><span class="hl-code">.</span><span class="hl-var">$pi</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> ...</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div>
</div></div><br class="example-break">
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="ch08.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>