16#include <unordered_map>
61 {0x1000,
"{TRIANGLE}"},
77 {0x1010,
"{JOYSTICK}"},
78 {0x1011,
"{UNDERSCORE}"},
119 {0x8023,
"{MAGENTA}"},
121 {0x8032,
"{EWHITE}"},
122 {0x8033,
"{EBLACK}"},
124 {0x8035,
"{EMAGENTA}"},
185 std::vector<IndexedString>
222 const std::vector<u16>& characters = {});
237bool IsOfType(
const std::filesystem::path& path);
256Text Import(
const std::filesystem::path& path);
348std::string
GenerateFNT(
const Text&
text,
const std::vector<u8>& advance_width,
const std::vector<STexture>& bitmaps,
362 std::vector<u32> offset_strings;
364 std::map<u32, std::vector<u16>> strings;
369 u32 num_characters = 0;
372 std::vector<u16> characters;
380Text Convert(RText&& rtext);
382RText Parse(Reader& f);
Provides functions and classes for handling binary data.
Contains macros and definitions for fixed-width types.
constexpr u32 FourCC(const char(&str)[5]) noexcept
Generates a numeric four character code from a given string.
Definition data.hpp:36
std::uint16_t u16
16-bit unsigned integer
Definition fixed_type.hpp:62
std::uint32_t u32
32-bit unsigned integer
Definition fixed_type.hpp:60
std::vector< STexture > bitmaps
Glyph atlases.
Definition text.hpp:291
float opacity_factor
A multiplier that makes glyphs brighter or dimmer.
Definition text.hpp:304
unsigned int columns
Number of glyphs in a row of the bitmap.
Definition text.hpp:303
bool simulate_kerning
Definition text.hpp:307
int spacing_offset
An additional offset for character spacing.
Definition text.hpp:306
unsigned int alpha_levels
Number of shades to use.
Definition text.hpp:310
float scale_factor
A multiplier that forcibly scales glyphs.
Definition text.hpp:305
bool filter_nearest
Flag to use the nearest/linear neighbor filtering.
Definition text.hpp:309
std::vector< u8 > advance_width
Definition text.hpp:292
unsigned int size
Definition text.hpp:301
Parameters for generating a bitmap font.
Definition text.hpp:300
Represents a bitmap font consisting of glyph atlases and advance widths.
Definition text.hpp:290
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.
BitmapFont GenerateBitmapFont(Text &text, const std::filesystem::path &ttf_font_path, const BitmapFontParams ¶ms={})
Generates a bitmap font from a TrueType font file.
std::vector< u16 > characters
A palette of unique UCS-2 encoded characters used by the strings.
Definition text.hpp:187
std::vector< IndexedString > strings
Strings consisting of special codes and indices that reference the characters array.
Definition text.hpp:186
Represents an in-game text archive.
Definition text.hpp:184
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.
const std::unordered_map< u16, std::string_view > kSpecialCodeToString
A default mapping of special codes to string representations.
Definition text.hpp:60
Text Import(BufferView buffer)
Parses a binary file and converts it to a Text object.
std::vector< u16 > IndexedString
A string consisting of special codes and indices into the character lookup table.
Definition text.hpp:168
constexpr u16 kSpecialCodeMask
A bitmask for identifying special codes within an IndexedString.
Definition text.hpp:49
bool IsOfType(BufferView buffer)
Tests if the provided file is a text archive.
Buffer Export(const Text &text)
Converts a text archive to a binary file representation.
constexpr u32 kMagicBytes
Magic Bytes.
Definition text.hpp:358
Provides classes for reading and writing binary data to and from various sources.
Contains structures and functions for working with in-game text archives.
Definition text.hpp:34
Definition exception.hpp:56
Provides data structures for representing essential components of a texture.