NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
text.hpp File Reference

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

#include <unordered_map>
#include "NNL/common/fixed_type.hpp"
#include "NNL/common/io.hpp"
#include "NNL/simple_asset/stexture.hpp"
#include "NNL/utility/data.hpp"

Go to the source code of this file.

Classes

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

Namespaces

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

Typedefs

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

Functions

std::vector< std::string > nnl::text::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 nnl::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 nnl::text::IsOfType (BufferView buffer)
 Tests if the provided file is a text archive.
Text nnl::text::Import (BufferView buffer)
 Parses a binary file and converts it to a Text object.
Buffer nnl::text::Export (const Text &text)
 Converts a text archive to a binary file representation.
BitmapFont nnl::text::GenerateBitmapFont (Text &text, const std::filesystem::path &ttf_font_path, const BitmapFontParams &params={})
 Generates a bitmap font from a TrueType font file.
std::string nnl::text::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 nnl::text::kSpecialCodeMask = 0xF000
 A bitmask for identifying special codes within an IndexedString.
const std::unordered_map< u16, std::string_view > nnl::text::kSpecialCodeToString
 A default mapping of special codes to string representations.
constexpr u32 nnl::text::raw::kMagicBytes = utl::data::FourCC("CDL!")
 Magic Bytes.

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