Improve code style

This commit is contained in:
halx99 2022-06-13 14:28:09 +08:00
parent 864c73154c
commit 6c63c55abb
2 changed files with 14 additions and 18 deletions

View File

@ -281,18 +281,13 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text)
tempDef.U = tempDef.U / scaleFactor;
tempDef.V = tempDef.V / scaleFactor;
tempDef.rotated = false;
updateTextureContent(pixelFormat, startY);
}
else
{ // don't render anythings
{
if (bitmap)
delete[] bitmap;
if (tempDef.xAdvance)
tempDef.validDefinition = true;
else
tempDef.validDefinition = false;
tempDef.validDefinition = !!tempDef.xAdvance;
tempDef.width = 0;
tempDef.height = 0;
tempDef.U = 0;
@ -307,6 +302,8 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text)
_letterDefinitions[charCode] = tempDef;
}
updateTextureContent(pixelFormat, startY);
return true;
}
@ -371,7 +368,6 @@ void FontAtlas::addNewPage()
texture->release();
_currentPageOrigY = 0;
}
void FontAtlas::setTexture(unsigned int slot, Texture2D* texture)

View File

@ -404,7 +404,7 @@ unsigned char* FontFreeType::getGlyphBitmap(char32_t charCode,
if (_mssingGlyphCharacter != 0)
{
if (_mssingGlyphCharacter == 0x1A)
return nullptr; // don't render anything for this character
break; // don't render anything for this character
// Try get new glyph index with missing glyph character code
glyphIndex = FT_Get_Char_Index(_fontFace, static_cast<FT_ULong>(_mssingGlyphCharacter));