mirror of
https://github.com/love2d/love.git
synced 2026-08-22 05:25:11 +02:00
Cleaned up TrueType Rasterizer code
This commit is contained in:
@@ -30,16 +30,9 @@ namespace font
|
||||
namespace freetype
|
||||
{
|
||||
|
||||
struct la
|
||||
{
|
||||
unsigned char l,a;
|
||||
};
|
||||
|
||||
TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data *data, int size)
|
||||
: data(data)
|
||||
{
|
||||
data->retain();
|
||||
|
||||
if (FT_New_Memory_Face(library,
|
||||
(const FT_Byte *)data->getData(), /* first byte in memory */
|
||||
data->getSize(), /* size in bytes */
|
||||
@@ -55,6 +48,8 @@ TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data *data, int size)
|
||||
metrics.ascent = s.ascender >> 6;
|
||||
metrics.descent = s.descender >> 6;
|
||||
metrics.height = s.height >> 6;
|
||||
|
||||
data->retain();
|
||||
}
|
||||
|
||||
TrueTypeRasterizer::~TrueTypeRasterizer()
|
||||
@@ -93,7 +88,6 @@ GlyphData *TrueTypeRasterizer::getGlyphData(unsigned int glyph) const
|
||||
|
||||
GlyphData *glyphData = new GlyphData(glyph, glyphMetrics, GlyphData::FORMAT_LUMINANCE_ALPHA);
|
||||
|
||||
{
|
||||
int size = bitmap.rows * bitmap.width;
|
||||
unsigned char *dst = (unsigned char *) glyphData->getData();
|
||||
|
||||
@@ -104,7 +98,6 @@ GlyphData *TrueTypeRasterizer::getGlyphData(unsigned int glyph) const
|
||||
dst[2*i] = 255;
|
||||
dst[2*i+1] = bitmap.buffer[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Having copied the data over, we can destroy the glyph
|
||||
FT_Done_Glyph(ftglyph);
|
||||
@@ -115,7 +108,7 @@ GlyphData *TrueTypeRasterizer::getGlyphData(unsigned int glyph) const
|
||||
|
||||
int TrueTypeRasterizer::getNumGlyphs() const
|
||||
{
|
||||
return 256;
|
||||
return face->num_glyphs;
|
||||
}
|
||||
|
||||
} // freetype
|
||||
|
||||
Reference in New Issue
Block a user