Style formatting. No code changes.
This commit is contained in:
+27
-15
@@ -95,7 +95,7 @@ JLBFont::~JLBFont()
|
|||||||
if (mTexture)
|
if (mTexture)
|
||||||
delete mTexture;
|
delete mTexture;
|
||||||
|
|
||||||
// JGERelease();
|
// JGERelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -113,16 +113,20 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
|||||||
|
|
||||||
float width = GetStringWidth(string);
|
float width = GetStringWidth(string);
|
||||||
|
|
||||||
if (align == JGETEXT_RIGHT) {
|
if (align == JGETEXT_RIGHT)
|
||||||
if (displayWidth) {
|
{
|
||||||
|
if (displayWidth)
|
||||||
|
{
|
||||||
dx0 -= displayWidth;
|
dx0 -= displayWidth;
|
||||||
leftOffset += width - displayWidth;
|
leftOffset += width - displayWidth;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dx0 -= width;
|
dx0 -= width;
|
||||||
}
|
}
|
||||||
else if (align == JGETEXT_CENTER) {
|
else if (align == JGETEXT_CENTER)
|
||||||
if (displayWidth) {
|
{
|
||||||
|
if (displayWidth)
|
||||||
|
{
|
||||||
dx0 -= displayWidth/2;
|
dx0 -= displayWidth/2;
|
||||||
leftOffset += width/2 - displayWidth/2;
|
leftOffset += width/2 - displayWidth/2;
|
||||||
}
|
}
|
||||||
@@ -136,7 +140,8 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
|||||||
int index;
|
int index;
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
if (*p == '\n') {
|
if (*p == '\n')
|
||||||
|
{
|
||||||
p++;
|
p++;
|
||||||
dy += (mHeight * 1.1 * mScale);
|
dy += (mHeight * 1.1 * mScale);
|
||||||
dy = floorf(dy);
|
dy = floorf(dy);
|
||||||
@@ -145,7 +150,8 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Skip characters with no encoding.
|
//Skip characters with no encoding.
|
||||||
if((*p - 32) < 0 || (*p - 32) > 127){
|
if((*p - 32) < 0 || (*p - 32) > 127)
|
||||||
|
{
|
||||||
p++;
|
p++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -155,16 +161,22 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
|||||||
float charWidth = mCharWidth[index];
|
float charWidth = mCharWidth[index];
|
||||||
float delta = (charWidth + mTracking) * mScale;
|
float delta = (charWidth + mTracking) * mScale;
|
||||||
float xPos = mXPos[index];
|
float xPos = mXPos[index];
|
||||||
if (leftOffset){
|
if (leftOffset)
|
||||||
if (leftOffset < 0){
|
{
|
||||||
|
if (leftOffset < 0)
|
||||||
|
{
|
||||||
dx-=leftOffset;
|
dx-=leftOffset;
|
||||||
leftOffset = 0;
|
leftOffset = 0;
|
||||||
//continue;
|
//continue;
|
||||||
}else if (leftOffset - delta > 0){
|
}
|
||||||
|
else if (leftOffset - delta > 0)
|
||||||
|
{
|
||||||
leftOffset -= delta;
|
leftOffset -= delta;
|
||||||
p++;
|
p++;
|
||||||
continue;
|
continue;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
xPos = mXPos[index] + (leftOffset);
|
xPos = mXPos[index] + (leftOffset);
|
||||||
delta -= leftOffset;
|
delta -= leftOffset;
|
||||||
leftOffset = 0;
|
leftOffset = 0;
|
||||||
@@ -172,10 +184,12 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
|||||||
charWidth = (delta/mScale) - mTracking;
|
charWidth = (delta/mScale) - mTracking;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (displayWidth){
|
if (displayWidth)
|
||||||
|
{
|
||||||
// This condiction must be tested indepently in the case leftOffset and displayWidth need a fix at the same time.
|
// This condiction must be tested indepently in the case leftOffset and displayWidth need a fix at the same time.
|
||||||
if (dx > x0+displayWidth) return;
|
if (dx > x0+displayWidth) return;
|
||||||
if (dx+delta > x0+displayWidth) {
|
if (dx+delta > x0+displayWidth)
|
||||||
|
{
|
||||||
delta = x0 + displayWidth - dx;
|
delta = x0 + displayWidth - dx;
|
||||||
charWidth = (delta/mScale) - mTracking;
|
charWidth = (delta/mScale) - mTracking;
|
||||||
}
|
}
|
||||||
@@ -184,9 +198,7 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
|||||||
mRenderer->RenderQuad(mQuad, dx, dy, mRotation, mScale, mScale);
|
mRenderer->RenderQuad(mQuad, dx, dy, mRotation, mScale, mScale);
|
||||||
dx += delta;
|
dx += delta;
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user