Not even with long texts and small scales

This commit is contained in:
Dynamitos
2022-04-17 09:10:20 +02:00
parent 03e1a5784d
commit 796271f334
17 changed files with 127 additions and 105 deletions
+9 -3
View File
@@ -37,11 +37,13 @@ uint8 transparentPixel = 0;
void FontAsset::load()
{
FT_Library ft;
assert(!FT_Init_FreeType(&ft));
FT_Error error = FT_Init_FreeType(&ft);
assert(!error);
FT_Face face;
assert(!FT_New_Face(ft, getFullPath().c_str(), 0, &face));
error = FT_New_Face(ft, getFullPath().c_str(), 0, &face);
assert(!error);
FT_Set_Pixel_Sizes(face, 0, 48);
for(uint8 c = 0; c < 128; ++c)
for(uint32 c = 0; c < 256; ++c)
{
Gfx::PGraphics graphics = WindowManager::getGraphics();
if(FT_Load_Char(face, c, FT_LOAD_RENDER))
@@ -61,6 +63,10 @@ void FontAsset::load()
imageData.resourceData.size = imageData.width * imageData.height;
if(imageData.width == 0 || imageData.width == 0)
{
glyph.size.x = 1;
glyph.size.y = 1;
glyph.bearing.x = 0;
glyph.bearing.y = 0;
imageData.width = 1;
imageData.height = 1;
imageData.resourceData.size = sizeof(uint8);
+2 -2
View File
@@ -21,9 +21,9 @@ public:
IVector2 bearing;
uint32 advance;
};
const Map<uint32, Glyph> getGlyphData() const { return glyphs; }
const std::map<uint32, Glyph> getGlyphData() const { return glyphs; }
private:
Map<uint32, Glyph> glyphs;
std::map<uint32, Glyph> glyphs;
};
DECLARE_REF(FontAsset)
} // namespace Seele