@@ -62,6 +62,7 @@ void Font::GetCharacter(Char c, FontCharacterEntry& result, bool enableFallback)
|
|||||||
|
|
||||||
// Create character cache
|
// Create character cache
|
||||||
FontManager::AddNewEntry(this, c, result);
|
FontManager::AddNewEntry(this, c, result);
|
||||||
|
ASSERT(result.Font);
|
||||||
|
|
||||||
// Add to the dictionary
|
// Add to the dictionary
|
||||||
_characters.Add(c, result);
|
_characters.Add(c, result);
|
||||||
|
|||||||
@@ -161,6 +161,12 @@ bool FontManager::AddNewEntry(Font* font, Char c, FontCharacterEntry& entry)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Init the character data
|
||||||
|
Platform::MemoryClear(&entry, sizeof(entry));
|
||||||
|
entry.Character = c;
|
||||||
|
entry.Font = font;
|
||||||
|
entry.IsValid = false;
|
||||||
|
|
||||||
// Load the glyph
|
// Load the glyph
|
||||||
const FT_Error error = FT_Load_Glyph(face, glyphIndex, glyphFlags);
|
const FT_Error error = FT_Load_Glyph(face, glyphIndex, glyphFlags);
|
||||||
if (error)
|
if (error)
|
||||||
@@ -195,8 +201,6 @@ bool FontManager::AddNewEntry(Font* font, Char c, FontCharacterEntry& entry)
|
|||||||
ASSERT(bitmap && bitmap->pixel_mode == FT_PIXEL_MODE_GRAY);
|
ASSERT(bitmap && bitmap->pixel_mode == FT_PIXEL_MODE_GRAY);
|
||||||
|
|
||||||
// Fill the character data
|
// Fill the character data
|
||||||
Platform::MemoryClear(&entry, sizeof(entry));
|
|
||||||
entry.Character = c;
|
|
||||||
entry.AdvanceX = Convert26Dot6ToRoundedPixel<int16>(glyph->advance.x);
|
entry.AdvanceX = Convert26Dot6ToRoundedPixel<int16>(glyph->advance.x);
|
||||||
entry.OffsetY = glyph->bitmap_top;
|
entry.OffsetY = glyph->bitmap_top;
|
||||||
entry.OffsetX = glyph->bitmap_left;
|
entry.OffsetX = glyph->bitmap_left;
|
||||||
@@ -289,7 +293,6 @@ bool FontManager::AddNewEntry(Font* font, Char c, FontCharacterEntry& entry)
|
|||||||
entry.UVSize.X = static_cast<float>(slot->Width - 2 * padding);
|
entry.UVSize.X = static_cast<float>(slot->Width - 2 * padding);
|
||||||
entry.UVSize.Y = static_cast<float>(slot->Height - 2 * padding);
|
entry.UVSize.Y = static_cast<float>(slot->Height - 2 * padding);
|
||||||
entry.Slot = slot;
|
entry.Slot = slot;
|
||||||
entry.Font = font;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user