569 lines
37 KiB
HTML
569 lines
37 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<title>SFML - Simple and Fast Multimedia Library</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html;"/>
|
||
|
<meta charset="utf-8"/>
|
||
|
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
||
|
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
|
||
|
<script type="text/javascript" src="jquery.js"></script>
|
||
|
<script type="text/javascript" src="dynsections.js"></script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="banner-container">
|
||
|
<div id="banner">
|
||
|
<span id="sfml">SFML 2.5.1</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="content">
|
||
|
<!-- Generated by Doxygen 1.8.14 -->
|
||
|
<div id="navrow1" class="tabs">
|
||
|
<ul class="tablist">
|
||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
||
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
|
||
|
<li><a href="files.html"><span>Files</span></a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div id="navrow2" class="tabs2">
|
||
|
<ul class="tablist">
|
||
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
||
|
<li><a href="classes.html"><span>Class Index</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 id="nav-path" class="navpath">
|
||
|
<ul>
|
||
|
<li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1Font.html">Font</a></li> </ul>
|
||
|
</div>
|
||
|
</div><!-- top -->
|
||
|
<div class="header">
|
||
|
<div class="summary">
|
||
|
<a href="#nested-classes">Classes</a> |
|
||
|
<a href="#pub-methods">Public Member Functions</a> |
|
||
|
<a href="classsf_1_1Font-members.html">List of all members</a> </div>
|
||
|
<div class="headertitle">
|
||
|
<div class="title">sf::Font Class Reference<div class="ingroups"><a class="el" href="group__graphics.html">Graphics module</a></div></div> </div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
|
||
|
<p>Class for loading and manipulating character fonts.
|
||
|
<a href="classsf_1_1Font.html#details">More...</a></p>
|
||
|
|
||
|
<p><code>#include <<a class="el" href="Font_8hpp_source.html">Font.hpp</a>></code></p>
|
||
|
<table class="memberdecls">
|
||
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
|
||
|
Classes</h2></td></tr>
|
||
|
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structsf_1_1Font_1_1Info.html">Info</a></td></tr>
|
||
|
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Holds various information about a font. <a href="structsf_1_1Font_1_1Info.html#details">More...</a><br /></td></tr>
|
||
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
</table><table class="memberdecls">
|
||
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
||
|
Public Member Functions</h2></td></tr>
|
||
|
<tr class="memitem:a506404655b8869ed60d1e7709812f583"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a506404655b8869ed60d1e7709812f583">Font</a> ()</td></tr>
|
||
|
<tr class="memdesc:a506404655b8869ed60d1e7709812f583"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#a506404655b8869ed60d1e7709812f583">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a506404655b8869ed60d1e7709812f583"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a72d7322b355ee2f1be4500f530e98081"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a72d7322b355ee2f1be4500f530e98081">Font</a> (const <a class="el" href="classsf_1_1Font.html">Font</a> &copy)</td></tr>
|
||
|
<tr class="memdesc:a72d7322b355ee2f1be4500f530e98081"><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <a href="#a72d7322b355ee2f1be4500f530e98081">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a72d7322b355ee2f1be4500f530e98081"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:aa18a3c62e6e01e9a21c531b5cad4b7f2"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#aa18a3c62e6e01e9a21c531b5cad4b7f2">~Font</a> ()</td></tr>
|
||
|
<tr class="memdesc:aa18a3c62e6e01e9a21c531b5cad4b7f2"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#aa18a3c62e6e01e9a21c531b5cad4b7f2">More...</a><br /></td></tr>
|
||
|
<tr class="separator:aa18a3c62e6e01e9a21c531b5cad4b7f2"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:ab020052ef4e01f6c749a85571c0f3fd1"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#ab020052ef4e01f6c749a85571c0f3fd1">loadFromFile</a> (const std::string &filename)</td></tr>
|
||
|
<tr class="memdesc:ab020052ef4e01f6c749a85571c0f3fd1"><td class="mdescLeft"> </td><td class="mdescRight">Load the font from a file. <a href="#ab020052ef4e01f6c749a85571c0f3fd1">More...</a><br /></td></tr>
|
||
|
<tr class="separator:ab020052ef4e01f6c749a85571c0f3fd1"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:abf2f8d6de31eb4e1db02e061c323e346"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#abf2f8d6de31eb4e1db02e061c323e346">loadFromMemory</a> (const void *data, std::size_t sizeInBytes)</td></tr>
|
||
|
<tr class="memdesc:abf2f8d6de31eb4e1db02e061c323e346"><td class="mdescLeft"> </td><td class="mdescRight">Load the font from a file in memory. <a href="#abf2f8d6de31eb4e1db02e061c323e346">More...</a><br /></td></tr>
|
||
|
<tr class="separator:abf2f8d6de31eb4e1db02e061c323e346"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:abc3f37a354ce8b9a21f8eb93bd9fdafb"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#abc3f37a354ce8b9a21f8eb93bd9fdafb">loadFromStream</a> (<a class="el" href="classsf_1_1InputStream.html">InputStream</a> &stream)</td></tr>
|
||
|
<tr class="memdesc:abc3f37a354ce8b9a21f8eb93bd9fdafb"><td class="mdescLeft"> </td><td class="mdescRight">Load the font from a custom stream. <a href="#abc3f37a354ce8b9a21f8eb93bd9fdafb">More...</a><br /></td></tr>
|
||
|
<tr class="separator:abc3f37a354ce8b9a21f8eb93bd9fdafb"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a7f33b30315f6ce8d8b4acfdabba065f7"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="structsf_1_1Font_1_1Info.html">Info</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a7f33b30315f6ce8d8b4acfdabba065f7">getInfo</a> () const</td></tr>
|
||
|
<tr class="memdesc:a7f33b30315f6ce8d8b4acfdabba065f7"><td class="mdescLeft"> </td><td class="mdescRight">Get the font information. <a href="#a7f33b30315f6ce8d8b4acfdabba065f7">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a7f33b30315f6ce8d8b4acfdabba065f7"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a308876e51e75bb69844fa3926a214fbf"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1Glyph.html">Glyph</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a308876e51e75bb69844fa3926a214fbf">getGlyph</a> (Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness=0) const</td></tr>
|
||
|
<tr class="memdesc:a308876e51e75bb69844fa3926a214fbf"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve a glyph of the font. <a href="#a308876e51e75bb69844fa3926a214fbf">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a308876e51e75bb69844fa3926a214fbf"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a5e1d5aca772d4765ce940670c2f786a6"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a5e1d5aca772d4765ce940670c2f786a6">getKerning</a> (Uint32 first, Uint32 second, unsigned int characterSize) const</td></tr>
|
||
|
<tr class="memdesc:a5e1d5aca772d4765ce940670c2f786a6"><td class="mdescLeft"> </td><td class="mdescRight">Get the kerning offset of two glyphs. <a href="#a5e1d5aca772d4765ce940670c2f786a6">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a5e1d5aca772d4765ce940670c2f786a6"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a4538cc8af337393208a87675fe1c3e59"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a4538cc8af337393208a87675fe1c3e59">getLineSpacing</a> (unsigned int characterSize) const</td></tr>
|
||
|
<tr class="memdesc:a4538cc8af337393208a87675fe1c3e59"><td class="mdescLeft"> </td><td class="mdescRight">Get the line spacing. <a href="#a4538cc8af337393208a87675fe1c3e59">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a4538cc8af337393208a87675fe1c3e59"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a726a55f40c19ac108e348b103190caad"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a726a55f40c19ac108e348b103190caad">getUnderlinePosition</a> (unsigned int characterSize) const</td></tr>
|
||
|
<tr class="memdesc:a726a55f40c19ac108e348b103190caad"><td class="mdescLeft"> </td><td class="mdescRight">Get the position of the underline. <a href="#a726a55f40c19ac108e348b103190caad">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a726a55f40c19ac108e348b103190caad"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:ad6d0a5bc6c026fe85c239f1f822b54e6"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#ad6d0a5bc6c026fe85c239f1f822b54e6">getUnderlineThickness</a> (unsigned int characterSize) const</td></tr>
|
||
|
<tr class="memdesc:ad6d0a5bc6c026fe85c239f1f822b54e6"><td class="mdescLeft"> </td><td class="mdescRight">Get the thickness of the underline. <a href="#ad6d0a5bc6c026fe85c239f1f822b54e6">More...</a><br /></td></tr>
|
||
|
<tr class="separator:ad6d0a5bc6c026fe85c239f1f822b54e6"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a15528d289f91cfd4b2597f8a9423e612"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1Texture.html">Texture</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a15528d289f91cfd4b2597f8a9423e612">getTexture</a> (unsigned int characterSize) const</td></tr>
|
||
|
<tr class="memdesc:a15528d289f91cfd4b2597f8a9423e612"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the texture containing the loaded glyphs of a certain size. <a href="#a15528d289f91cfd4b2597f8a9423e612">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a15528d289f91cfd4b2597f8a9423e612"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:a232515549846e3172a514d0b47918399"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classsf_1_1Font.html">Font</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Font.html#a232515549846e3172a514d0b47918399">operator=</a> (const <a class="el" href="classsf_1_1Font.html">Font</a> &right)</td></tr>
|
||
|
<tr class="memdesc:a232515549846e3172a514d0b47918399"><td class="mdescLeft"> </td><td class="mdescRight">Overload of assignment operator. <a href="#a232515549846e3172a514d0b47918399">More...</a><br /></td></tr>
|
||
|
<tr class="separator:a232515549846e3172a514d0b47918399"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
</table>
|
||
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||
|
<div class="textblock"><p>Class for loading and manipulating character fonts. </p>
|
||
|
<p>Fonts can be loaded from a file, from memory or from a custom stream, and supports the most common types of fonts.</p>
|
||
|
<p>See the loadFromFile function for the complete list of supported formats.</p>
|
||
|
<p>Once it is loaded, a <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> instance provides three types of information about the font: </p><ul>
|
||
|
<li>Global metrics, such as the line spacing </li>
|
||
|
<li>Per-glyph metrics, such as bounding box or kerning </li>
|
||
|
<li>Pixel representation of glyphs</li>
|
||
|
</ul>
|
||
|
<p>Fonts alone are not very useful: they hold the font data but cannot make anything useful of it. To do so you need to use the <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a> class, which is able to properly output text with several options such as character size, style, color, position, rotation, etc. This separation allows more flexibility and better performances: indeed a <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a> is a lightweight object which can combine the glyphs data and metrics of a <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> to display any text on a render target. Note that it is also possible to bind several <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a> instances to the same <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a>.</p>
|
||
|
<p>It is important to note that the <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a> instance doesn't copy the font that it uses, it only keeps a reference to it. Thus, a <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> must not be destructed while it is used by a <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a> (i.e. never write a function that uses a local <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> instance for creating a text).</p>
|
||
|
<p>Usage example: </p><div class="fragment"><div class="line"><span class="comment">// Declare a new font</span></div><div class="line"><a class="code" href="classsf_1_1Font.html">sf::Font</a> font;</div><div class="line"></div><div class="line"><span class="comment">// Load it from a file</span></div><div class="line"><span class="keywordflow">if</span> (!font.<a class="code" href="classsf_1_1Font.html#ab020052ef4e01f6c749a85571c0f3fd1">loadFromFile</a>(<span class="stringliteral">"arial.ttf"</span>))</div><div class="line">{</div><div class="line"> <span class="comment">// error...</span></div><div class="line">}</div><div class="line"></div><div class="line"><span class="comment">// Create a text which uses our font</span></div><div class="line"><a class="code" href="classsf_1_1Text.html">sf::Text</a> text1;</div><div class="line">text1.<a class="code" href="classsf_1_1Text.html#a2927805d1ae92d57f15034ea34756b81">setFont</a>(font);</div><div class="line">text1.<a class="code" href="classsf_1_1Text.html#ae96f835fc1bff858f8a23c5b01eaaf7e">setCharacterSize</a>(30);</div><div class="line">text1.<a class="code" href="classsf_1_1Text.html#ad791702bc2d1b6590a1719aa60635edf">setStyle</a>(<a class="code" href="classsf_1_1Text.html#aa8add4aef484c6e6b20faff07452bd82a2af9ae5e1cda126570f744448e0caa32">sf::Text::Regular</a>);</div><div class="line"></div><div class="line"><span class="comment">// Create another text using the same font, but with different parameters</span></div><div class="line"><a class="code" href="classsf_1_1Text.html">sf::Text</a> text2;</div><div class="line">text2.<a class="code" href="classsf_1_1Text.html#a2927805d1ae92d57f15034ea34756b81">setFont</a>(font);</div><div class="line">text2.<a class="code" href="classsf_1_1Text.html#ae96f835fc1bff858f8a23c5b01eaaf7e">setCharacterSize</a>(50);</div><div class="line">text2.<a class="code" href="classsf_1_1Text.html#ad791702bc2d1b6590a1719aa60635edf">setStyle</a>(<a class="code" href="classsf_1_1Text.html#aa8add4aef484c6e6b20faff07452bd82aee249eb803848723c542c2062ebe69d8">sf::Text::Italic</a>);</div></div><!-- fragment --><p>Apart from loading font files, and passing them to instances of <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a>, you should normally not have to deal directly with this class. However, it may be useful to access the font metrics or rasterized glyphs for advanced usage.</p>
|
||
|
<p>Note that if the font is a bitmap font, it is not scalable, thus not all requested sizes will be available to use. This needs to be taken into consideration when using <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a>. If you need to display text of a certain size, make sure the corresponding bitmap font that supports that size is used.</p>
|
||
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a> </dd></dl>
|
||
|
|
||
|
<p class="definition">Definition at line <a class="el" href="Font_8hpp_source.html#l00050">50</a> of file <a class="el" href="Font_8hpp_source.html">Font.hpp</a>.</p>
|
||
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
||
|
<a id="a506404655b8869ed60d1e7709812f583"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a506404655b8869ed60d1e7709812f583">◆ </a></span>Font() <span class="overload">[1/2]</span></h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">sf::Font::Font </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramname"></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Default constructor. </p>
|
||
|
<p>This constructor defines an empty font </p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a72d7322b355ee2f1be4500f530e98081"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a72d7322b355ee2f1be4500f530e98081">◆ </a></span>Font() <span class="overload">[2/2]</span></h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">sf::Font::Font </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">const <a class="el" href="classsf_1_1Font.html">Font</a> & </td>
|
||
|
<td class="paramname"><em>copy</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Copy constructor. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">copy</td><td>Instance to copy </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="aa18a3c62e6e01e9a21c531b5cad4b7f2"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#aa18a3c62e6e01e9a21c531b5cad4b7f2">◆ </a></span>~Font()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">sf::Font::~Font </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramname"></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Destructor. </p>
|
||
|
<p>Cleans up all the internal resources used by the font </p>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<h2 class="groupheader">Member Function Documentation</h2>
|
||
|
<a id="a308876e51e75bb69844fa3926a214fbf"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a308876e51e75bb69844fa3926a214fbf">◆ </a></span>getGlyph()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">const <a class="el" href="classsf_1_1Glyph.html">Glyph</a>& sf::Font::getGlyph </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">Uint32 </td>
|
||
|
<td class="paramname"><em>codePoint</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">unsigned int </td>
|
||
|
<td class="paramname"><em>characterSize</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">bool </td>
|
||
|
<td class="paramname"><em>bold</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">float </td>
|
||
|
<td class="paramname"><em>outlineThickness</em> = <code>0</code> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td>)</td>
|
||
|
<td></td><td> const</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Retrieve a glyph of the font. </p>
|
||
|
<p>If the font is a bitmap font, not all character sizes might be available. If the glyph is not available at the requested size, an empty glyph is returned.</p>
|
||
|
<p>Be aware that using a negative value for the outline thickness will cause distorted rendering.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">codePoint</td><td>Unicode code point of the character to get </td></tr>
|
||
|
<tr><td class="paramname">characterSize</td><td>Reference character size </td></tr>
|
||
|
<tr><td class="paramname">bold</td><td>Retrieve the bold version or the regular one? </td></tr>
|
||
|
<tr><td class="paramname">outlineThickness</td><td>Thickness of outline (when != 0 the glyph will not be filled)</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>The glyph corresponding to <em>codePoint</em> and <em>characterSize</em> </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a7f33b30315f6ce8d8b4acfdabba065f7"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a7f33b30315f6ce8d8b4acfdabba065f7">◆ </a></span>getInfo()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">const <a class="el" href="structsf_1_1Font_1_1Info.html">Info</a>& sf::Font::getInfo </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramname"></td><td>)</td>
|
||
|
<td> const</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Get the font information. </p>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>A structure that holds the font information </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a5e1d5aca772d4765ce940670c2f786a6"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a5e1d5aca772d4765ce940670c2f786a6">◆ </a></span>getKerning()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">float sf::Font::getKerning </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">Uint32 </td>
|
||
|
<td class="paramname"><em>first</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">Uint32 </td>
|
||
|
<td class="paramname"><em>second</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">unsigned int </td>
|
||
|
<td class="paramname"><em>characterSize</em> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td>)</td>
|
||
|
<td></td><td> const</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Get the kerning offset of two glyphs. </p>
|
||
|
<p>The kerning is an extra offset (negative) to apply between two glyphs when rendering them, to make the pair look more "natural". For example, the pair "AV" have a special kerning to make them closer than other characters. Most of the glyphs pairs have a kerning offset of zero, though.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">first</td><td>Unicode code point of the first character </td></tr>
|
||
|
<tr><td class="paramname">second</td><td>Unicode code point of the second character </td></tr>
|
||
|
<tr><td class="paramname">characterSize</td><td>Reference character size</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>Kerning value for <em>first</em> and <em>second</em>, in pixels </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a4538cc8af337393208a87675fe1c3e59"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a4538cc8af337393208a87675fe1c3e59">◆ </a></span>getLineSpacing()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">float sf::Font::getLineSpacing </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">unsigned int </td>
|
||
|
<td class="paramname"><em>characterSize</em></td><td>)</td>
|
||
|
<td> const</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Get the line spacing. </p>
|
||
|
<p>Line spacing is the vertical offset to apply between two consecutive lines of text.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">characterSize</td><td>Reference character size</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>Line spacing, in pixels </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a15528d289f91cfd4b2597f8a9423e612"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a15528d289f91cfd4b2597f8a9423e612">◆ </a></span>getTexture()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">const <a class="el" href="classsf_1_1Texture.html">Texture</a>& sf::Font::getTexture </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">unsigned int </td>
|
||
|
<td class="paramname"><em>characterSize</em></td><td>)</td>
|
||
|
<td> const</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Retrieve the texture containing the loaded glyphs of a certain size. </p>
|
||
|
<p>The contents of the returned texture changes as more glyphs are requested, thus it is not very relevant. It is mainly used internally by <a class="el" href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. ">sf::Text</a>.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">characterSize</td><td>Reference character size</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classsf_1_1Texture.html" title="Image living on the graphics card that can be used for drawing. ">Texture</a> containing the glyphs of the requested size </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a726a55f40c19ac108e348b103190caad"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a726a55f40c19ac108e348b103190caad">◆ </a></span>getUnderlinePosition()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">float sf::Font::getUnderlinePosition </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">unsigned int </td>
|
||
|
<td class="paramname"><em>characterSize</em></td><td>)</td>
|
||
|
<td> const</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Get the position of the underline. </p>
|
||
|
<p>Underline position is the vertical offset to apply between the baseline and the underline.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">characterSize</td><td>Reference character size</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>Underline position, in pixels</dd></dl>
|
||
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Font.html#ad6d0a5bc6c026fe85c239f1f822b54e6" title="Get the thickness of the underline. ">getUnderlineThickness</a> </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="ad6d0a5bc6c026fe85c239f1f822b54e6"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#ad6d0a5bc6c026fe85c239f1f822b54e6">◆ </a></span>getUnderlineThickness()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">float sf::Font::getUnderlineThickness </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">unsigned int </td>
|
||
|
<td class="paramname"><em>characterSize</em></td><td>)</td>
|
||
|
<td> const</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Get the thickness of the underline. </p>
|
||
|
<p>Underline thickness is the vertical size of the underline.</p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">characterSize</td><td>Reference character size</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>Underline thickness, in pixels</dd></dl>
|
||
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Font.html#a726a55f40c19ac108e348b103190caad" title="Get the position of the underline. ">getUnderlinePosition</a> </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="ab020052ef4e01f6c749a85571c0f3fd1"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#ab020052ef4e01f6c749a85571c0f3fd1">◆ </a></span>loadFromFile()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">bool sf::Font::loadFromFile </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">const std::string & </td>
|
||
|
<td class="paramname"><em>filename</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Load the font from a file. </p>
|
||
|
<p>The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. Note that this function knows nothing about the standard fonts installed on the user's system, thus you can't load them directly.</p>
|
||
|
<dl class="section warning"><dt>Warning</dt><dd>SFML cannot preload all the font data in this function, so the file has to remain accessible until the <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> object loads a new font or is destroyed.</dd></dl>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">filename</td><td>Path of the font file to load</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>True if loading succeeded, false if it failed</dd></dl>
|
||
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Font.html#abf2f8d6de31eb4e1db02e061c323e346" title="Load the font from a file in memory. ">loadFromMemory</a>, <a class="el" href="classsf_1_1Font.html#abc3f37a354ce8b9a21f8eb93bd9fdafb" title="Load the font from a custom stream. ">loadFromStream</a> </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="abf2f8d6de31eb4e1db02e061c323e346"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#abf2f8d6de31eb4e1db02e061c323e346">◆ </a></span>loadFromMemory()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">bool sf::Font::loadFromMemory </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">const void * </td>
|
||
|
<td class="paramname"><em>data</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">std::size_t </td>
|
||
|
<td class="paramname"><em>sizeInBytes</em> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td>)</td>
|
||
|
<td></td><td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Load the font from a file in memory. </p>
|
||
|
<p>The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42.</p>
|
||
|
<dl class="section warning"><dt>Warning</dt><dd>SFML cannot preload all the font data in this function, so the buffer pointed by <em>data</em> has to remain valid until the <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> object loads a new font or is destroyed.</dd></dl>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">data</td><td>Pointer to the file data in memory </td></tr>
|
||
|
<tr><td class="paramname">sizeInBytes</td><td>Size of the data to load, in bytes</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>True if loading succeeded, false if it failed</dd></dl>
|
||
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Font.html#ab020052ef4e01f6c749a85571c0f3fd1" title="Load the font from a file. ">loadFromFile</a>, <a class="el" href="classsf_1_1Font.html#abc3f37a354ce8b9a21f8eb93bd9fdafb" title="Load the font from a custom stream. ">loadFromStream</a> </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="abc3f37a354ce8b9a21f8eb93bd9fdafb"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#abc3f37a354ce8b9a21f8eb93bd9fdafb">◆ </a></span>loadFromStream()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">bool sf::Font::loadFromStream </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype"><a class="el" href="classsf_1_1InputStream.html">InputStream</a> & </td>
|
||
|
<td class="paramname"><em>stream</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Load the font from a custom stream. </p>
|
||
|
<p>The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. Warning: SFML cannot preload all the font data in this function, so the contents of <em>stream</em> have to remain valid as long as the font is used.</p>
|
||
|
<dl class="section warning"><dt>Warning</dt><dd>SFML cannot preload all the font data in this function, so the stream has to remain accessible until the <a class="el" href="classsf_1_1Font.html" title="Class for loading and manipulating character fonts. ">sf::Font</a> object loads a new font or is destroyed.</dd></dl>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">stream</td><td>Source stream to read from</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>True if loading succeeded, false if it failed</dd></dl>
|
||
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Font.html#ab020052ef4e01f6c749a85571c0f3fd1" title="Load the font from a file. ">loadFromFile</a>, <a class="el" href="classsf_1_1Font.html#abf2f8d6de31eb4e1db02e061c323e346" title="Load the font from a file in memory. ">loadFromMemory</a> </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a id="a232515549846e3172a514d0b47918399"></a>
|
||
|
<h2 class="memtitle"><span class="permalink"><a href="#a232515549846e3172a514d0b47918399">◆ </a></span>operator=()</h2>
|
||
|
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname"><a class="el" href="classsf_1_1Font.html">Font</a>& sf::Font::operator= </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">const <a class="el" href="classsf_1_1Font.html">Font</a> & </td>
|
||
|
<td class="paramname"><em>right</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Overload of assignment operator. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">right</td><td>Instance to assign</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="section return"><dt>Returns</dt><dd>Reference to self </dd></dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
||
|
<li><a class="el" href="Font_8hpp_source.html">Font.hpp</a></li>
|
||
|
</ul>
|
||
|
</div><!-- contents -->
|
||
|
</div>
|
||
|
<div id="footer-container">
|
||
|
<div id="footer">
|
||
|
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
|
||
|
Copyright © Laurent Gomila ::
|
||
|
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> ::
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|