diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-08-22 19:18:37 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-08-22 19:18:37 +0100 |
commit | 69c69e8b33ab83d7e6a6f06f3691f3bccf413f4c (patch) | |
tree | ebc5f7be617701a3cb2741e159c93e404a55eb50 /ui/font.h | |
parent | Make utf8_string_view work on any contiguous collection of chars (diff) | |
download | ilt-69c69e8b33ab83d7e6a6f06f3691f3bccf413f4c.tar.bz2 ilt-69c69e8b33ab83d7e6a6f06f3691f3bccf413f4c.tar.xz ilt-69c69e8b33ab83d7e6a6f06f3691f3bccf413f4c.zip |
Use utf8_string_view for processing text to renderings
Diffstat (limited to 'ui/font.h')
-rw-r--r-- | ui/font.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -10,6 +10,7 @@ #include <glm/glm.hpp> #include <map> #include <string_view> +#include <unicode.h> #include <vector> class Font { @@ -21,7 +22,7 @@ public: using Quad = std::array<glm::vec4, 4>; using Quads = std::vector<Quad>; using TextureQuads = std::map<GLuint /*textureId*/, Quads>; - TextureQuads render(const std::string_view text) const; + TextureQuads render(const utf8_string_view text) const; struct CharData { size_t textureIdx; @@ -38,12 +39,12 @@ public: static glm::uvec3 getTextureSize(unsigned int height); protected: - void generateChars(const std::string_view text) const; + void generateChars(const utf8_string_view text) const; const CharData getChar(char) const; std::size_t getTextureWithSpace(unsigned int adv) const; std::filesystem::path path; glm::uvec3 size; - mutable std::map<uint32_t, CharData> charsData; + mutable std::map<decltype(get_codepoint(nullptr)), CharData> charsData; mutable std::vector<FontTexture> fontTextures; }; |