diff options
author | chai <chaifix@163.com> | 2018-10-15 07:18:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-15 07:18:13 +0800 |
commit | ddfedbff7d9ea4f344173ef2c228a51a778d7433 (patch) | |
tree | 4e8c40bee95f5ba91a2808ca9a14cea5937bea52 /src/libjin/Graphics/Font/TTF.cpp | |
parent | b1bbc998960fff2169dc5a992c47d08723472f9b (diff) |
+从TTFData创建TTF的接口
Diffstat (limited to 'src/libjin/Graphics/Font/TTF.cpp')
-rw-r--r-- | src/libjin/Graphics/Font/TTF.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libjin/Graphics/Font/TTF.cpp b/src/libjin/Graphics/Font/TTF.cpp index 98e57dd..5c77e7f 100644 --- a/src/libjin/Graphics/Font/TTF.cpp +++ b/src/libjin/Graphics/Font/TTF.cpp @@ -55,6 +55,20 @@ namespace graphics free(raw.data); } + TTF* TTFData::createTTF(unsigned ttfsize) + { + TTF* ttf; + try + { + ttf = new TTF(this, ttfsize); + } + catch (...) + { + return nullptr; + } + return ttf; + } + /* * (0, 0) * +--------------+ ascent @@ -417,6 +431,7 @@ namespace graphics const Color* bitmap = ttf->getCodepointBitmap(character, &w, &h, &xoff, &yoff); int adw, lsb; { + /* bake glyph */ ttf->getHMetrics(character, &adw, &lsb); ttf->popTTFsize(); if (cursor.x + adw > textureWidth ) |