Style formatting. No code changes.
This commit is contained in:
+26
-14
@@ -113,16 +113,20 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
||||
|
||||
float width = GetStringWidth(string);
|
||||
|
||||
if (align == JGETEXT_RIGHT) {
|
||||
if (displayWidth) {
|
||||
if (align == JGETEXT_RIGHT)
|
||||
{
|
||||
if (displayWidth)
|
||||
{
|
||||
dx0 -= displayWidth;
|
||||
leftOffset += width - displayWidth;
|
||||
}
|
||||
else
|
||||
dx0 -= width;
|
||||
}
|
||||
else if (align == JGETEXT_CENTER) {
|
||||
if (displayWidth) {
|
||||
else if (align == JGETEXT_CENTER)
|
||||
{
|
||||
if (displayWidth)
|
||||
{
|
||||
dx0 -= 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;
|
||||
while (*p)
|
||||
{
|
||||
if (*p == '\n') {
|
||||
if (*p == '\n')
|
||||
{
|
||||
p++;
|
||||
dy += (mHeight * 1.1 * mScale);
|
||||
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.
|
||||
if((*p - 32) < 0 || (*p - 32) > 127){
|
||||
if((*p - 32) < 0 || (*p - 32) > 127)
|
||||
{
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
@@ -155,16 +161,22 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
||||
float charWidth = mCharWidth[index];
|
||||
float delta = (charWidth + mTracking) * mScale;
|
||||
float xPos = mXPos[index];
|
||||
if (leftOffset){
|
||||
if (leftOffset < 0){
|
||||
if (leftOffset)
|
||||
{
|
||||
if (leftOffset < 0)
|
||||
{
|
||||
dx-=leftOffset;
|
||||
leftOffset = 0;
|
||||
//continue;
|
||||
}else if (leftOffset - delta > 0){
|
||||
}
|
||||
else if (leftOffset - delta > 0)
|
||||
{
|
||||
leftOffset -= delta;
|
||||
p++;
|
||||
continue;
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
xPos = mXPos[index] + (leftOffset);
|
||||
delta -= leftOffset;
|
||||
leftOffset = 0;
|
||||
@@ -172,10 +184,12 @@ void JLBFont::DrawString(const char *string, float x, float y, int align, float
|
||||
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.
|
||||
if (dx > x0+displayWidth) return;
|
||||
if (dx+delta > x0+displayWidth) {
|
||||
if (dx+delta > x0+displayWidth)
|
||||
{
|
||||
delta = x0 + displayWidth - dx;
|
||||
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);
|
||||
dx += delta;
|
||||
p++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user