From ddfedbff7d9ea4f344173ef2c228a51a778d7433 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 15 Oct 2018 07:18:13 +0800 Subject: =?UTF-8?q?+=E4=BB=8ETTFData=E5=88=9B=E5=BB=BATTF=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Graphics/Font/TTF.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libjin/Graphics/Font/TTF.cpp') 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 ) -- cgit v1.1-26-g67d0