jak-project/common/util/FontUtils.h
ManDude 0e96cdb6c5
[de/compiler] New text tool (#918)
* fix `citb-drop-plat` a bit and PAL `fisher`

* Clean up `pc-pad-utils`. Looks so clean!

* Increase process stacks by ~2x

* Convert `game_text` custom encoding to and from a readable one (UTF-8)

* clang

* add missing characters

* support all diacritic variants

* fix a character

* remaining cases

* fix tests

* fix memory leak?

* clang

* add custom characters w/ diacritics

* Update all-types.gc

* robustness

* minor bug

* move custom font decoding function to `FontUtils.cpp`

* Move valid source chars patching to Reader constructor
2021-10-19 00:02:18 -04:00

41 lines
1,007 B
C++

#pragma once
/*!
* @file FontUtils.h
*
* Code for handling text and strings in Jak 1's "large font" format.
*
* MAKE SURE THIS FILE IS ENCODED IN UTF-8!!! The various strings here depend on it.
* Always verify the encoding if string detection suddenly goes awry.
*/
#include "common/common_types.h"
#include <string>
#include <vector>
struct RemapInfo {
std::string chars;
std::vector<u8> bytes;
};
struct ReplaceInfo {
std::string from;
std::string to;
};
/*!
* Remaps UTF-8 characters to the appropriate character fit for the game's large font.
* It is unfortunately quite large.
*/
extern std::vector<RemapInfo> g_font_large_char_remap;
/*!
* Replaces specific UTF-8 strings with more readable variants.
*/
extern std::vector<ReplaceInfo> g_font_large_string_replace;
RemapInfo* jak1_bytes_to_utf8(const char* in);
std::string& jak1_trans_to_utf8(std::string& str);
std::string convert_to_jak1_encoding(std::string str);
std::string convert_from_jak1_encoding(const char* in);