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/ch08s03.html
2011-05-28 19:51:52 +10:00

49 lines
5.6 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Understanding text alignment and anchor point</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">Understanding text alignment and anchor point</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="Understanding text alignment and anchor point"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2498561"></a>Understanding text alignment and anchor point</h2></div></div></div>
<p>When a text string position is specified that screen (or scale) position by
default gets aligned with the top left corner of the strings bounding box. We say
that the top left corner is the <span class="italic">anchor point</span> of the text string. The alignment of the
anchor point can be adjusted with a call to <code class="code">Text::SetAlignment($aHorAlign,
$vertAlign)</code>. The two arguments are given as text strings and the
admissible values for each argument are: </p>
<p>
</p><div class="variablelist"><dl><dt><span class="term">Horizontal alignment</span></dt><dd>
<p><code class="code">'left'</code>, <code class="code">'center'</code>,
<code class="code">'right'</code></p>
</dd><dt><span class="term">Vertical alignment</span></dt><dd>
<p><code class="code">'bottom'</code>, <code class="code">'center'</code> (or
<code class="code">'middle'</code>) , <code class="code">'top'</code></p>
</dd></dl></div><p>
</p>
<div class="caution" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3>
<p>Even though from an API perspective both bitmap fonts and TTF fonts share the
same user API the implementation is vastly different. There are a number of
subtle differences in the way built-in bit-map fonts and TrueType fonts are
rendered to the screen. This means for example that the alignment of, say the
bottom of the text string, is not pixel-perfect between bitmap and TrueType
fonts However, JpGraph, abstracts away 99.9% of the differences so it will be,
for all practical uses of the library completely transparent to switch between
the different font types.</p>
</div>
<p>Manually setting the alignment for the anchor point is mostly useful when adding
Text object to the graph to get the wanted alignment. You can see an example of how
the anchor point changes depending on how the combination of alignments are used in <a class="xref" href="ch08s03.html#fig.textalignex1" title="Figure 8.2. Illustration of anchor point alignment (textalignex1.php)">Figure 8.2. Illustration of anchor point alignment <code class="uri"><a class="uri" href="example_src/textalignex1.html" target="_top">(<code class="filename">textalignex1.php</code>)</a></code> </a></p>
<p>
</p><div class="figure"><a name="fig.textalignex1"></a><p class="title"><b>Figure 8.2. Illustration of anchor point alignment <code class="uri"><a class="uri" href="example_src/textalignex1.html" target="_top">(<code class="filename">textalignex1.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/textalignex1.png" alt="Illustration of anchor point alignment (textalignex1.php)"></span> </div></div><p><br class="figure-break">
</p>
<p>
</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>
<p>It might seem strange to have the method name
"<code class="code">SetAlignment()</code>" when it really should make more sense to use
the name "<code class="code">SetAnchor()</code>". We agree. This naming scheme is due to
historical reasons.</p>
</div><p>
</p>
<p>
</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>
<p>The graph legend box also have an anchor point that is specified as the
3:rd and 4:th argument to Legend::SetPos()</p>
</div><p>
</p>
</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>