nw::font::ArchiveFont::GetRequireBufferSize Member Function

Syntax

static u32 GetRequireBufferSize(
     const void * bfnt,
     const char * glyphGroups = LOAD_GLYPH_ALL
);

Arguments

Name Description
in bfnt Pointer to the header portion of the font resource.
in glyphGroups String specifying the glyph group to load.

Return Values

Returns the buffer size required for constructing the font with the Construct function or the InitStreamingConstruct function.
Returns 0 if the buffer size could not be calculated for some reason, such as an invalid resource bfnt.

Description

Calculates the buffer size required to construct the font.

The brfnt argument specifies a pointer to the header portion of the archive font loaded into memory. At least an amount equal to ArchiveFont::HEADER_SIZE (=16KB) needs to be loaded from the beginning of the file.

Specify in glyphGroups a comma-delimited string of the glyph groups to be loaded. For example, to make available the glyphs belonging to the "ascii" group, specify as follows:

u32 requireSize = ArchiveFont::GetRequireBufferSize(brfnt, "ascii");

To make available the glyphs belonging to the "ascii", "european", and "jis0" groups, specify as follows:

u32 requireSize = ArchiveFont::GetRequireBufferSize(brfnt, "ascii,european,jis0");

There is no significance to the order of the group names.
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 "*". In the following example, glyphs belonging to the "ascii" group and glyphs not belonging to any group are specified.

u32 requireSize = ArchiveFont::GetRequireBufferSize(brfnt, "ascii,*");

As a special case, all glyphs contained in an archive font are loaded when the empty string is specified in glyphGroups. Because nw4r::ut::ArchiveFont::LOAD_GLYPH_ALL, the default argument for glyphGroups, is the empty string, all glyphs are loaded by default.

The same size buffer is required to construct a font whether the Construct function is used or the pair of the nw::font::ArchiveFont::InitStreamingConstruct function and the nw::font::ArchiveFont::StreamingConstruct function are used.

See Also

nw::font::Font::Font
nw::font::ArchiveFont::InitStreamingConstruct
nw::font::ArchiveFont::StreamingConstruct
nw::font::ArchiveFont::Construct

Revision History

2009/11/09
Initial version.

CONFIDENTIAL