diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-02-20 21:00:26 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-02-20 21:00:26 -0500 |
| commit | 76a38d7f972b17c33a6ffd6dc3772df721139e67 (patch) | |
| tree | bee9b1edd87ff6ebe6eb1e9687a4ca0858052f9c /src | |
| parent | 09989000cd5787578c0676b279d3ecbc9ca50524 (diff) | |
pke: chkpt: minimum required unicode chars
Diffstat (limited to 'src')
| -rw-r--r-- | src/font.cpp | 4 | ||||
| -rw-r--r-- | src/font.hpp | 9 | ||||
| -rw-r--r-- | src/game.cpp | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/font.cpp b/src/font.cpp index 6357a1d..bf03d1a 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -1120,7 +1120,7 @@ FontRenderHandle FontType_AddStringRender(FontTypeIndex idx_ft, const pk_str str // determine unicode char ii = utf8_to_unicode(&str.val[i], u); if (ii == 0) { - fprintf(stderr, "failed to determine unicode for character: '%c' at byte index: '%i'\n", str.val[i], i); + fprintf(stderr, "failed to determine unicode for character: at byte index: '%i'\n", i); i += 1; continue; } @@ -1139,7 +1139,7 @@ FontRenderHandle FontType_AddStringRender(FontTypeIndex idx_ft, const pk_str str } while (fgc->unicode != u && l <= r); if (fgc->unicode != u) { - fprintf(stderr, "font: '%s' doesn't contain unicode character '%u': '%lc'\n", ft->title.val, u, (wint_t)u); + fprintf(stderr, "font: '%s' does not contain unicode character '%u'\n", ft->title.val, u); continue; } count += 1; diff --git a/src/font.hpp b/src/font.hpp index 46ffcf9..2d1e55a 100644 --- a/src/font.hpp +++ b/src/font.hpp @@ -10,6 +10,13 @@ TypeSafeInt_H(FontTypeIndex, uint16_t, 0xFFFF); TypeSafeInt_H(FontRenderIndex, uint16_t, 0xFFFF); +enum FONT_GLYPH_CHAR_FLAGS : uint8_t { + FONT_GLYPH_CHAR_FLAGS_NONE = (0 << 0), + FONT_GLYPH_CHAR_FLAGS_CONTROL = (1 << 0), + FONT_GLYPH_CHAR_FLAGS_WHITESPACE = (1 << 1), + FONT_GLYPH_CHAR_FLAGS_NEW_LINE = (1 << 2), +}; + enum FONT_RENDER_SURFACE_AREA_TYPE_FLAGS : uint8_t { FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_NONE = 0, FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_GROW_VERTICAL = (1 << 0), @@ -30,7 +37,7 @@ struct FontGlyphChar { glm::vec2 sprite_region_max; glm::dvec4 plane_bounds; uint32_t unicode; - bool is_whitespace; + FONT_GLYPH_CHAR_FLAGS flags; }; struct FontRenderSettings { float char_scale; diff --git a/src/game.cpp b/src/game.cpp index 6714910..85c2fd5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -609,11 +609,11 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) { } } - // pk_cstr test_text = cstring_to_pk_cstr("0123456789 The quick brown fox jumped over the lazy dog."); - pk_cstr test_text = cstring_to_pk_cstr("%+-*0123456789$"); + pk_cstr test_text = cstring_to_pk_cstr("012\n3456789\tThe quick brown fox jumped over the lazy dog."); + // pk_cstr test_text = cstring_to_pk_cstr("%+-*0123456789$"); // pk_cstr test_text = cstring_to_pk_cstr("$#"); // pk_cstr test_text = cstring_to_pk_cstr("$"); - pk_cstr test_text2 = cstring_to_pk_cstr("+0123456789 The quick brown fox jumped over the lazy dog."); + pk_cstr test_text2 = cstring_to_pk_cstr("+0123456\n789\tThe quick brown fox jumped over the lazy dog."); FontTypeIndex font_type_count; FontRenderSettings fr_set; fr_set.char_scale = 9 * 7.0; |
