<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Guichan: gcn::DefaultFont Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.7 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li id="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul></div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul></div> <div class="nav"> <a class="el" href="namespacegcn.html">gcn</a>::<a class="el" href="classgcn_1_1DefaultFont.html">DefaultFont</a></div> <h1>gcn::DefaultFont Class Reference</h1><!-- doxytag: class="gcn::DefaultFont" --><!-- doxytag: inherits="gcn::Font" --><code>#include <<a class="el" href="defaultfont_8hpp-source.html">defaultfont.hpp</a>></code> <p> <p>Inheritance diagram for gcn::DefaultFont: <p><center><img src="classgcn_1_1DefaultFont.png" usemap="#gcn::DefaultFont_map" border="0" alt=""></center> <map name="gcn::DefaultFont_map"> <area href="classgcn_1_1Font.html" alt="gcn::Font" shape="rect" coords="0,0,104,24"> </map> <a href="classgcn_1_1DefaultFont-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2> A font only capable of drawing rectangles. <p> It is used by default merely to show that no font have been set. <p> <p> Definition at line <a class="el" href="defaultfont_8hpp-source.html#l00069">69</a> of file <a class="el" href="defaultfont_8hpp-source.html">defaultfont.hpp</a>.<table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b606ee0708758b5fafd19cfc8938b624"></a><!-- doxytag: member="gcn::DefaultFont::~DefaultFont" ref="b606ee0708758b5fafd19cfc8938b624" args="()" --> virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcn_1_1DefaultFont.html#b606ee0708758b5fafd19cfc8938b624">~DefaultFont</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcn_1_1DefaultFont.html#5b6ab73374e18e7f22696b7b2a1afa08">drawGlyph</a> (<a class="el" href="classgcn_1_1Graphics.html">Graphics</a> *graphics, unsigned char glyph, int x, int y)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Draws a glyph as a rectangle. <a href="#5b6ab73374e18e7f22696b7b2a1afa08"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcn_1_1DefaultFont.html#3cdd4f449bd2114312df6970c6ae2571">drawString</a> (<a class="el" href="classgcn_1_1Graphics.html">Graphics</a> *graphics, const std::string &text, int x, int y)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Draws a string. <a href="#3cdd4f449bd2114312df6970c6ae2571"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcn_1_1DefaultFont.html#62d609afe7f0d0dec90a0ae1cb4731ea">getWidth</a> (const std::string &text) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the width of a string. <a href="#62d609afe7f0d0dec90a0ae1cb4731ea"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcn_1_1DefaultFont.html#64f2f7bcce5d3780106634e36ac0a52a">getHeight</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the height of the glyphs in the font. <a href="#64f2f7bcce5d3780106634e36ac0a52a"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgcn_1_1DefaultFont.html#10b802c51de668171c2255f2e11fc063">getStringIndexAt</a> (const std::string &text, int x)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets a string index in a string providing an x coordinate. <a href="#10b802c51de668171c2255f2e11fc063"></a><br></td></tr> </table> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="5b6ab73374e18e7f22696b7b2a1afa08"></a><!-- doxytag: member="gcn::DefaultFont::drawGlyph" ref="5b6ab73374e18e7f22696b7b2a1afa08" args="(Graphics *graphics, unsigned char glyph, int x, int y)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int gcn::DefaultFont::drawGlyph </td> <td>(</td> <td class="paramtype"><a class="el" href="classgcn_1_1Graphics.html">Graphics</a> * </td> <td class="paramname"> <em>graphics</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned char </td> <td class="paramname"> <em>glyph</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>y</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Draws a glyph as a rectangle. <p> The glyphs always be drawn as rectangles no matter the glyph.<p> NOTE: You normally won't use this function to draw text since the <a class="el" href="classgcn_1_1Graphics.html">Graphics</a> class contains better functions for drawing text.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>graphics</em> </td><td>a <a class="el" href="classgcn_1_1Graphics.html">Graphics</a> object to be used for drawing. </td></tr> <tr><td valign="top"></td><td valign="top"><em>glyph</em> </td><td>a glyph to draw. </td></tr> <tr><td valign="top"></td><td valign="top"><em>x</em> </td><td>the x coordinate where to draw the glyph. </td></tr> <tr><td valign="top"></td><td valign="top"><em>y</em> </td><td>the y coordinate where to draw the glyph. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>the width of the glyph in pixels. </dd></dl> <p> Definition at line <a class="el" href="defaultfont_8cpp-source.html#l00080">80</a> of file <a class="el" href="defaultfont_8cpp-source.html">defaultfont.cpp</a>. <p> References <a class="el" href="classgcn_1_1Graphics.html#8ffb254f53931ce3809a6f10307fcbf2">gcn::Graphics::drawRectangle()</a>. <p> Referenced by <a class="el" href="defaultfont_8cpp-source.html#l00087">drawString()</a>. </div> </div><p> <a class="anchor" name="3cdd4f449bd2114312df6970c6ae2571"></a><!-- doxytag: member="gcn::DefaultFont::drawString" ref="3cdd4f449bd2114312df6970c6ae2571" args="(Graphics *graphics, const std::string &text, int x, int y)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void gcn::DefaultFont::drawString </td> <td>(</td> <td class="paramtype"><a class="el" href="classgcn_1_1Graphics.html">Graphics</a> * </td> <td class="paramname"> <em>graphics</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const std::string & </td> <td class="paramname"> <em>text</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>y</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Draws a string. <p> NOTE: You normally won't use this function to draw text since <a class="el" href="classgcn_1_1Graphics.html">Graphics</a> contains better functions for drawing text.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>graphics</em> </td><td>a <a class="el" href="classgcn_1_1Graphics.html">Graphics</a> object to use for drawing. </td></tr> <tr><td valign="top"></td><td valign="top"><em>text</em> </td><td>the string to draw. </td></tr> <tr><td valign="top"></td><td valign="top"><em>x</em> </td><td>the x coordinate where to draw the string. </td></tr> <tr><td valign="top"></td><td valign="top"><em>y</em> </td><td>the y coordinate where to draw the string. </td></tr> </table> </dl> <p> Implements <a class="el" href="classgcn_1_1Font.html#055c403050f483cc2c67477443d98eee">gcn::Font</a>. <p> Definition at line <a class="el" href="defaultfont_8cpp-source.html#l00087">87</a> of file <a class="el" href="defaultfont_8cpp-source.html">defaultfont.cpp</a>. <p> References <a class="el" href="defaultfont_8cpp-source.html#l00080">drawGlyph()</a>, and <a class="el" href="defaultfont_8cpp-source.html#l00075">getWidth()</a>. </div> </div><p> <a class="anchor" name="64f2f7bcce5d3780106634e36ac0a52a"></a><!-- doxytag: member="gcn::DefaultFont::getHeight" ref="64f2f7bcce5d3780106634e36ac0a52a" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int gcn::DefaultFont::getHeight </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Gets the height of the glyphs in the font. <p> <dl compact><dt><b>Returns:</b></dt><dd>the height of the glyphs int the font. </dd></dl> <p> Implements <a class="el" href="classgcn_1_1Font.html#a270d8934a16d4065143e3617b1fa926">gcn::Font</a>. <p> Definition at line <a class="el" href="defaultfont_8cpp-source.html#l00070">70</a> of file <a class="el" href="defaultfont_8cpp-source.html">defaultfont.cpp</a>. </div> </div><p> <a class="anchor" name="10b802c51de668171c2255f2e11fc063"></a><!-- doxytag: member="gcn::DefaultFont::getStringIndexAt" ref="10b802c51de668171c2255f2e11fc063" args="(const std::string &text, int x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int gcn::DefaultFont::getStringIndexAt </td> <td>(</td> <td class="paramtype">const std::string & </td> <td class="paramname"> <em>text</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>x</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Gets a string index in a string providing an x coordinate. <p> Used to retrive a string index (for a character in a string) at a certain x position. It is especially useful when a mouse clicks in a <a class="el" href="classgcn_1_1TextField.html">TextField</a> and you want to know which character was clicked.<p> <dl compact><dt><b>Returns:</b></dt><dd>a string index in a string providing an x coordinate. </dd></dl> <p> Reimplemented from <a class="el" href="classgcn_1_1Font.html#3210f4c53424ade4b188b8dfb1f686a4">gcn::Font</a>. <p> Definition at line <a class="el" href="defaultfont_8cpp-source.html#l00098">98</a> of file <a class="el" href="defaultfont_8cpp-source.html">defaultfont.cpp</a>. </div> </div><p> <a class="anchor" name="62d609afe7f0d0dec90a0ae1cb4731ea"></a><!-- doxytag: member="gcn::DefaultFont::getWidth" ref="62d609afe7f0d0dec90a0ae1cb4731ea" args="(const std::string &text) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int gcn::DefaultFont::getWidth </td> <td>(</td> <td class="paramtype">const std::string & </td> <td class="paramname"> <em>text</em> </td> <td> ) </td> <td width="100%"> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Gets the width of a string. <p> The width of a string is not necesserily the sum of all the widths of it's glyphs.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>text</em> </td><td>the string to return the width of. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>the width of a string. </dd></dl> <p> Implements <a class="el" href="classgcn_1_1Font.html#bb88894b1ebeda28edcac75c537f8e0f">gcn::Font</a>. <p> Definition at line <a class="el" href="defaultfont_8cpp-source.html#l00075">75</a> of file <a class="el" href="defaultfont_8cpp-source.html">defaultfont.cpp</a>. <p> Referenced by <a class="el" href="defaultfont_8cpp-source.html#l00087">drawString()</a>. </div> </div><p> <hr>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="defaultfont_8hpp-source.html">defaultfont.hpp</a><li><a class="el" href="defaultfont_8cpp-source.html">defaultfont.cpp</a></ul> <hr size="1"><address style="align: right;"><small>Generated on Sat Jul 29 19:38:48 2006 for Guichan by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address> </body> </html>