1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" />
7    <title>GetRequireBufferSize</title>
8  </head>
9  <body>
10    <h1><CODE>nw::font::PackedFont::GetRequireBufferSize</CODE> Member Function</h1>
11    <h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14static <span>u32</span> GetRequireBufferSize(
15     const void * bfnt,
16     <span>f32</span> rateSheetCache
17);
18</pre>
19    </div>
20    <h2>Arguments</h2>
21    <div class="section">
22      <table class="arguments">
23        <thead>
24          <tr>
25            <td width="15" />
26            <th>Name</th>
27            <td>Description</td>
28          </tr>
29        </thead>
30        <tr>
31          <td>in</td>
32          <th>bfnt</th>
33          <td>Pointer to the header portion of the binary resource (<CODE>bfnt</CODE>) loaded into memory.</td>
34        </tr>
35        <tr>
36          <td>in</td>
37          <th>rateSheetCache</th>
38          <td>Proportion of the maximum number of expanded sheets to cache to the number of sheets.</td>
39        </tr> </table>
40    </div>
41    <h2>Return Values</h2>
42    <div class="section">Returns the buffer size required for constructing the font with the <CODE><a href="../../../nw/font/ArchiveFont/Construct.html">Construct</a></CODE> function or the <CODE><a href="../../../nw/font/ArchiveFont/InitStreamingConstruct.html">InitStreamingConstruct</a></CODE> function. <br /> Returns 0 if the buffer size could not be calculated for some reason, such as an invalid resource <CODE>bfnt</CODE>. </div>
43    <h2>Description</h2>
44    <div class="section">
45      <p>Calculates the buffer size required to construct the font.</p><p>The <CODE>brfnt</CODE> argument specifies a pointer to the header portion of the archive font loaded into memory. At least an amount equal to <CODE>PackedFont::HEADER_SIZE</CODE> (= 16 KB) needs to be loaded from the beginning of the file.</p><p>Specify in <CODE>glyphGroups</CODE> a comma-delimited string of the glyph groups to be loaded. For example, to make available the glyphs belonging to the &quot;ascii&quot; group, specify as follows.</p><pre>u32 requireSize = PackedFont::GetRequireBufferSize(brfnt, &quot;ascii&quot;, rate);</pre><p>To make available the glyphs belonging to the &quot;ascii&quot;, &quot;european&quot;, and &quot;jis0&quot; groups, specify as follows.</p><pre>u32 requireSize = PackedFont::GetRequireBufferSize(brfnt, &quot;ascii,european,jis0&quot;, rate);</pre><p>  There is no significance to the order of the group names.<br /> These group names are defined by the glyph group specification (XGGP) file that is used when the archive font is created. Characters whose group is not defined by the glyph group specification (XGGP) file are assigned to the group with the name &quot;<CODE>*</CODE>&quot;. In the following example, glyphs belonging to the &quot;ascii&quot; group and glyphs not belonging to any group are specified.</p><pre>u32 requireSize = PackedFont::GetRequireBufferSize(brfnt, &quot;ascii,*&quot;);</pre><p>As a special case, all glyphs contained in an archive font are loaded when the empty string is specified in <CODE>glyphGroups</CODE>. In the function format where <CODE>glyphGroups</CODE> is not passed as an argument, the function proceeds assuming that an empty string was passed to <CODE>glyphGroups</CODE>. <code>nw::font::PackedFont::LOAD_GLYPH_ALL</code>, defined as the empty string, can also be explicitly passed.
46</p><p>Pass as the argument either <CODE>numSheetCache</CODE> or <CODE>rateSheetCache</CODE> to specify the number of expanded sheets to cache.<br /> With <CODE>numSheetCache</CODE>, the number of sheets to cache is specified directly.<br /> With <CODE>rateSheetCache</CODE>, the number of caches is specified in proportion to the number of loaded sheets.  For example, if the number of loaded sheets is 100 and the <CODE>rateSheetCache</CODE> is <CODE>0.3f</CODE>, the cache count is 30 (100 * 0.3). The cache count must be an integer to be meaningful. If it is not, it is truncated to an integer, and then the required memory size is calculated.<br /> With either function format, the cache count is clamped between 1 and the number of loaded sheets.</p><p>The same size buffer is required to construct a font whether the <CODE><a href="../../../nw/font/PackedFont/Construct.html">nw::font::PackedFont::Construct</a></CODE>function is used or the pair of the <CODE><a href="../../../nw/font/PackedFont/InitStreamingConstruct.html">nw::font::PackedFont::InitStreamingConstruct</a> </CODE> function and the <CODE><a href="../../../nw/font/PackedFont/StreamingConstruct.html">nw::font::PackedFont::StreamingConstruct</a></CODE> function are used.</p></div>
47    <h2>Revision History</h2>
48    <div class="section">
49      <dl class="history">
50        <dt>2010/10/15</dt>
51        <dd>Revised inappropriate namespace names.
52        </dd>
53        <dt>2009/11/09</dt>
54        <dd>Initial version.<br />
55        </dd>
56      </dl>
57    </div>
58  <hr><p>CONFIDENTIAL</p></body>
59</html>
60