Fixed the setsize bug for JTTFont in JGE.
This commit is contained in:
@@ -39,6 +39,7 @@ JTTFont::JTTFont(int cacheImageSize)
|
|||||||
{
|
{
|
||||||
|
|
||||||
mColor = ARGB(255,255,255,255);
|
mColor = ARGB(255,255,255,255);
|
||||||
|
mSize = 0;
|
||||||
mAngle = 0.0;
|
mAngle = 0.0;
|
||||||
mLibrary = 0;
|
mLibrary = 0;
|
||||||
mFace = 0;
|
mFace = 0;
|
||||||
@@ -112,6 +113,9 @@ bool JTTFont::SetSize(int size)
|
|||||||
if(!mFace)
|
if(!mFace)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (mSize == size)
|
||||||
|
return true;
|
||||||
|
|
||||||
// size is in 26.6 fixed point formant!
|
// size is in 26.6 fixed point formant!
|
||||||
if (FT_Set_Pixel_Sizes(mFace, size, size) == 0)
|
if (FT_Set_Pixel_Sizes(mFace, size, size) == 0)
|
||||||
{
|
{
|
||||||
@@ -131,6 +135,10 @@ bool JTTFont::SetSize(int size)
|
|||||||
|
|
||||||
FT_Set_Transform(mFace, 0, 0);
|
FT_Set_Transform(mFace, 0, 0);
|
||||||
|
|
||||||
|
// JTTFont.h says setting font size will clear the cache
|
||||||
|
for (int i = 0; i < TTF_CACHE_SIZE; i++)
|
||||||
|
mCachedCode[i] = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user