nw::font::PackedFont::Construct Member Function

Syntax

bool Construct(
     void * pBuffer,
     u32 bufferSize,
     const void * bfnt,
     const char * glyphGroups = LOAD_GLYPH_ALL
);

Arguments

Name Description
out pBuffer Pointer to the buffer associated with this instance. Must be aligned on a 128-byte boundary.
in bufferSize Size of the buffer pointed to by pBuffer.
in bfnt Pointer to the binary resource (bfnt) loaded into memory.
in glyphGroups String specifying the glyph group to load.

Return Values

Returns TRUE if the font is successfully constructed; otherwise, returns FALSE.
Fails if the archive font bfnt is illegal or if the buffer size is too small.

Description

Extracts the glyph group from the archive font and constructs a font.

For bufferSize, specify the buffer size that can be obtained with the nw::font::PackedFont::GetRequireBufferSizefunction. For pBuffer, specify the pointer to a memory region of that buffer size. When the font is successfully constructed, the memory region pointed to by pBuffer is under the management of this instance. Do not overwrite or release this memory region until the nw::font::PackedFont::Destroy function is called. The cache count specified by the nw::font::PackedFont::GetRequireBufferSize function does not need to be specified here because it can be obtained internally by inverse calculating bufferSize.

Specify the pointer to the archive font that has been loaded into memory in brfnt. The entire archive font must be loaded.

See the description for the nw::font::PackedFont::GetRequireBufferSize function for the meaning of the value specified by glyphGroups.

In contrast to the nw::font::ResFont::SetResource function, the memory region specified by brfnt is not associated with an instance. For this reason, after the Construct function succeeds, the memory region specified with brfnt can be released. In addition, the memory region specified by brfnt is not overwritten.

When calling the Construct function, two buffers are needed for pBuffer and brfnt. In addition to memory the size of the expanded archive font that is used after the font is constructed (pBuffer), memory the size of the archive font before expansion (brfnt) is also temporarily needed.
By using the function pair nw::font::PackedFont::InitStreamingConstruct and nw::font::PackedFont::StreamingConstruct instead of using the Construct function, you can construct the font without using a memory region equivalent to the size of the pre-expanded archive font (i.e., brfnt ) .

Revision History

2009/11/09
Initial version.

CONFIDENTIAL