diff options
author | chai <chaifix@163.com> | 2021-10-30 13:28:39 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-30 13:28:39 +0800 |
commit | c3e259f4d29e9bdcb73617ad8e4d71f117b4d289 (patch) | |
tree | 893ed7b892d0b3b49db2d3e219da28fc2eea4769 /Runtime/GUI | |
parent | b2433cf2faf5c5c3d82d61c7b44928923c5fdcda (diff) |
+freetype
Diffstat (limited to 'Runtime/GUI')
-rw-r--r-- | Runtime/GUI/TextGenerator.cpp | 16 | ||||
-rw-r--r-- | Runtime/GUI/TextGenerator.h | 22 | ||||
-rw-r--r-- | Runtime/GUI/freetype.h | 4 |
3 files changed, 41 insertions, 1 deletions
diff --git a/Runtime/GUI/TextGenerator.cpp b/Runtime/GUI/TextGenerator.cpp index 802146c..6841c4e 100644 --- a/Runtime/GUI/TextGenerator.cpp +++ b/Runtime/GUI/TextGenerator.cpp @@ -1,3 +1,19 @@ +#include "freetype.h" #include "TextGenerator.h" +#include "../Math/Math.h" +using namespace character; +//https://learnopengl.com/In-Practice/Text-Rendering + +struct Character { + unsigned int textureID; // ID handle of the glyph texture + Internal::Vector2 size; // Size of glyph + Internal::Vector2 bearing; // Offset from baseline to left/top of glyph + unsigned int advance; // Offset to advance to next glyph +}; + +hash TextGenerator::GetCharacterHash(unicode unicode, int pixelSize) +{ + +}
\ No newline at end of file diff --git a/Runtime/GUI/TextGenerator.h b/Runtime/GUI/TextGenerator.h index 8bd9dc8..eacc99c 100644 --- a/Runtime/GUI/TextGenerator.h +++ b/Runtime/GUI/TextGenerator.h @@ -1,10 +1,32 @@ #pragma once #include "Runtime/Utilities/Singleton.h" +#include <string> +#include <unordered_map> + +//https://learnopengl.com/In-Practice/Text-Rendering + +struct Character { + unsigned int textureID; // ID handle of the glyph texture + Internal::Vector2 size; // Size of glyph + Internal::Vector2 bearing; // Offset from baseline to left/top of glyph + unsigned int advance; // Offset to advance to next glyph +}; + +namespace character +{ + typedef wchar_t unicode; + typedef unsigned int hash; +} class TextGenerator : public Singleton<TextGenerator> { public: +private: + std::unordered_map<character::hash, Character> m_Characters; + + character::hash GetCharacterHash(character::unicode unicode, int pixelSize); + }; diff --git a/Runtime/GUI/freetype.h b/Runtime/GUI/freetype.h index 139597f..4b54e20 100644 --- a/Runtime/GUI/freetype.h +++ b/Runtime/GUI/freetype.h @@ -1,2 +1,4 @@ +#pragma once - +#include <ft2build.h> +#include FT_FREETYPE_H |