diff options
author | chai <chaifix@163.com> | 2018-09-11 19:45:38 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-11 19:45:38 +0800 |
commit | 0ea853c2aad2aa3670eb694328743bb806e603bf (patch) | |
tree | ef6b1f09331d992b870c78e842ce59ff755163b9 /src/libjin/Graphics | |
parent | b994fc716e2a71ded757ff18e5d7f21a6f64a85a (diff) |
*update
Diffstat (limited to 'src/libjin/Graphics')
-rw-r--r-- | src/libjin/Graphics/Font.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/libjin/Graphics/Font.h b/src/libjin/Graphics/Font.h index e4fa12b..0ab482d 100644 --- a/src/libjin/Graphics/Font.h +++ b/src/libjin/Graphics/Font.h @@ -15,9 +15,18 @@ namespace graphics class Font: public Drawable { public: - Font(); + Font * createFont(const char* file); + Font* createFont(const char* data, size_t size); - void loadFile(const char* file); + void box(const char* text, int fontHeight, int spacing, int lineHeight, int* w, int * h); + + private: + /* ASCII 32(space)..126(~) 95 glyphs */ + static const int ASCII_CHARACTER_NUM = 96; + + Font(); + + void loadFile(const char* file); void loadMemory(const unsigned char* data); void render( const char* text, // rendered text @@ -26,14 +35,9 @@ namespace graphics int spacing, // font spacing int lineHeight // line height ); - void box(const char* text, int fontHeight, int spacing, int lineHeight, int* w, int * h); - - private: - /* ASCII 32(space)..126(~) 95 glyphs */ - static const int ASCII_CHARACTER_NUM = 96; stbtt_bakedchar asciiData[ASCII_CHARACTER_NUM]; - + }; } // graphics |