NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
nnl::text Namespace Reference

Contains structures and functions for working with in-game text archives. More...

Classes

struct  BitmapFont
 Represents a bitmap font consisting of glyph atlases and advance widths. More...
struct  BitmapFontParams
 Parameters for generating a bitmap font. More...
struct  Text
 Represents an in-game text archive. More...

Typedefs

using IndexedString = std::vector<u16>
 A string consisting of special codes and indices into the character lookup table.

Functions

std::vector< std::string > Convert (const Text &text, const std::unordered_map< u16, std::string_view > &replacements=kSpecialCodeToString)
 Converts an in-game text archive to a vector of UTF-8 encoded strings.
Text Convert (const std::vector< std::string > &stext, const std::unordered_map< u16, std::string_view > &replacements=kSpecialCodeToString, const std::vector< u16 > &characters={})
 Converts a vector of UTF-8 encoded strings to an in-game text archive.
bool IsOfType (BufferView buffer)
 Tests if the provided file is a text archive.
Text Import (BufferView buffer)
 Parses a binary file and converts it to a Text object.
Buffer Export (const Text &text)
 Converts a text archive to a binary file representation.
BitmapFont GenerateBitmapFont (Text &text, const std::filesystem::path &ttf_font_path, const BitmapFontParams &params={})
 Generates a bitmap font from a TrueType font file.
std::string GenerateFNT (const Text &text, const std::vector< u8 > &advance_width, const std::vector< STexture > &bitmaps, int columns=-1)
 Generates a BMFont .fnt file.

Variables

constexpr u16 kSpecialCodeMask = 0xF000
 A bitmask for identifying special codes within an IndexedString.
const std::unordered_map< u16, std::string_view > kSpecialCodeToString
 A default mapping of special codes to string representations.

Detailed Description

Contains structures and functions for working with in-game text archives.

See also
nnl::text::Text
nnl::text::IsOfType
nnl::text::Import
nnl::text::Export
nnl::text::Convert