Using latest love-android branch (e263d91d136d)

This commit is contained in:
fysx
2014-04-04 11:37:36 +02:00
parent 8acfb8d91a
commit e96eef4435
87 changed files with 1070 additions and 397 deletions
+1 -1
View File
@@ -54,4 +54,4 @@ public:
} // font
} // love
#endif // LOVE_FONT_FONT_H
#endif // LOVE_FONT_FONT_H
+3 -3
View File
@@ -64,16 +64,16 @@ void *GlyphData::getData() const
return (void *) data;
}
int GlyphData::getSize() const
size_t GlyphData::getSize() const
{
switch (format)
{
case GlyphData::FORMAT_LUMINANCE_ALPHA:
return getWidth() * getHeight() * 2;
return size_t(getWidth() * getHeight() * 2);
break;
case GlyphData::FORMAT_RGBA:
default:
return getWidth() * getHeight() * 4;
return size_t(getWidth() * getHeight() * 4);
break;
}
+1 -1
View File
@@ -67,7 +67,7 @@ public:
// Implements Data.
void *getData() const;
int getSize() const;
size_t getSize() const;
/**
* Gets the height of the glyph.
+1 -1
View File
@@ -79,4 +79,4 @@ private:
} // font
} // love
#endif // LOVE_FONT_IMAGE_RASTERIZER_H
#endif // LOVE_FONT_IMAGE_RASTERIZER_H
+1 -1
View File
@@ -96,4 +96,4 @@ bool Rasterizer::hasGlyphs(const std::string &text) const
}
} // font
} // love
} // love
+1 -1
View File
@@ -114,4 +114,4 @@ protected:
} // font
} // love
#endif // LOVE_FONT_RASTERIZER_H
#endif // LOVE_FONT_RASTERIZER_H
@@ -33,12 +33,15 @@ namespace freetype
TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data *data, int size)
: data(data)
{
if (FT_New_Memory_Face(library,
(const FT_Byte *)data->getData(), /* first byte in memory */
data->getSize(), /* size in bytes */
0, /* face_index */
&face))
throw love::Exception("TrueTypeFont Loading error: FT_New_Face failed (there is probably a problem with your font file)");
FT_Error err = FT_Err_Ok;
err = FT_New_Memory_Face(library,
(const FT_Byte *)data->getData(), /* first byte in memory */
data->getSize(), /* size in bytes */
0, /* face_index */
&face);
if (err != FT_Err_Ok)
throw love::Exception("TrueType Font Loading error: FT_New_Face failed: 0x%x (problem with font file?)", err);
FT_Set_Pixel_Sizes(face, size, size);
@@ -68,12 +71,18 @@ GlyphData *TrueTypeRasterizer::getGlyphData(uint32 glyph) const
love::font::GlyphMetrics glyphMetrics = {};
FT_Glyph ftglyph;
// Initialize
if (FT_Load_Glyph(face, FT_Get_Char_Index(face, glyph), FT_LOAD_DEFAULT))
throw love::Exception("TrueTypeFont Loading error: FT_Load_Glyph failed");
FT_Error err = FT_Err_Ok;
if (FT_Get_Glyph(face->glyph, &ftglyph))
throw love::Exception("TrueTypeFont Loading error: FT_Get_Glyph failed");
// Initialize
err = FT_Load_Glyph(face, FT_Get_Char_Index(face, glyph), FT_LOAD_DEFAULT);
if (err != FT_Err_Ok)
throw love::Exception("TrueType Font Loading error: FT_Load_Glyph failed (0x%x)", err);
err = FT_Get_Glyph(face->glyph, &ftglyph);
if (err != FT_Err_Ok)
throw love::Exception("TrueType Font Loading error: FT_Get_Glyph failed (0x%x)", err);
FT_Glyph_To_Bitmap(&ftglyph, FT_RENDER_MODE_NORMAL, 0, 1);
@@ -146,4 +155,4 @@ bool TrueTypeRasterizer::hasGlyph(uint32 glyph) const
} // freetype
} // font
} // love
} // love