mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Updated love.font, and added Glyph object in love.graphics.
This commit is contained in:
@@ -25,9 +25,10 @@ namespace love
|
||||
namespace font
|
||||
{
|
||||
|
||||
GlyphData::GlyphData(wchar_t glyph, unsigned char * glyphData, GlyphMetrics glyphMetrics, int glyphBPP)
|
||||
: glyph(glyph), data(glyphData), metrics(glyphMetrics), bpp(glyphBPP)
|
||||
GlyphData::GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics)
|
||||
: glyph(glyph), metrics(glyphMetrics)
|
||||
{
|
||||
data = new unsigned char[getWidth() * getHeight() * 2];
|
||||
}
|
||||
|
||||
GlyphData::~GlyphData()
|
||||
@@ -42,7 +43,7 @@ namespace font
|
||||
|
||||
int GlyphData::getSize() const
|
||||
{
|
||||
return getWidth() * getHeight() * bpp;
|
||||
return getWidth() * getHeight() * 2;
|
||||
}
|
||||
|
||||
int GlyphData::getHeight() const
|
||||
|
||||
@@ -47,19 +47,16 @@ namespace font
|
||||
{
|
||||
private:
|
||||
// The glyph itself
|
||||
wchar_t glyph;
|
||||
unsigned short glyph;
|
||||
|
||||
// Glyph metrics
|
||||
GlyphMetrics metrics;
|
||||
|
||||
// Glyph texture data
|
||||
unsigned char * data;
|
||||
|
||||
// Bits Per Pixel
|
||||
int bpp;
|
||||
|
||||
public:
|
||||
GlyphData(wchar_t glyph, unsigned char * glyphData, GlyphMetrics glyphMetrics, int glyphBPP);
|
||||
GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics);
|
||||
virtual ~GlyphData();
|
||||
|
||||
// Implements Data.
|
||||
|
||||
@@ -27,15 +27,15 @@ namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
ImageRasterizer::ImageRasterizer(love::filesystem::File * file, wchar_t * glyphs)
|
||||
: glyphs(glyphs)
|
||||
ImageRasterizer::ImageRasterizer(love::image::ImageData * data, unsigned short * glyphs)
|
||||
: imageData(imageData)
|
||||
{
|
||||
//imageData = new ImageData(file);
|
||||
imageData->retain();
|
||||
}
|
||||
|
||||
ImageRasterizer::~ImageRasterizer()
|
||||
{
|
||||
delete imageData;
|
||||
imageData->release();
|
||||
}
|
||||
|
||||
int ImageRasterizer::getLineHeight() const
|
||||
@@ -43,7 +43,7 @@ namespace font
|
||||
return getHeight();
|
||||
}
|
||||
|
||||
GlyphData * ImageRasterizer::getGlyphData(const wchar_t glyph) const
|
||||
GlyphData * ImageRasterizer::getGlyphData(unsigned short glyph) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,17 +38,14 @@ namespace font
|
||||
private:
|
||||
// The image data
|
||||
love::image::ImageData * imageData;
|
||||
|
||||
// Glyphs
|
||||
wchar_t * glyphs;
|
||||
|
||||
|
||||
public:
|
||||
ImageRasterizer(love::filesystem::File * file, wchar_t * glyphs);
|
||||
ImageRasterizer(love::image::ImageData * imageData, unsigned short * glyphs);
|
||||
virtual ~ImageRasterizer();
|
||||
|
||||
// Implement FontData
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData * getGlyphData(const wchar_t glyph) const;
|
||||
virtual GlyphData * getGlyphData(unsigned short glyph) const;
|
||||
|
||||
}; // ImageRasterizer
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@ namespace love
|
||||
namespace font
|
||||
{
|
||||
|
||||
Rasterizer::~Rasterizer()
|
||||
{
|
||||
}
|
||||
|
||||
int Rasterizer::getHeight() const
|
||||
{
|
||||
return metrics.height;
|
||||
|
||||
@@ -49,6 +49,9 @@ namespace font
|
||||
FontMetrics metrics;
|
||||
|
||||
public:
|
||||
|
||||
virtual ~Rasterizer();
|
||||
|
||||
/**
|
||||
* Gets the max height of the glyphs.
|
||||
**/
|
||||
@@ -78,10 +81,10 @@ namespace font
|
||||
* Gets a specific glyph.
|
||||
* @param glyph The (UNICODE) glyph to get data for
|
||||
**/
|
||||
virtual GlyphData * getGlyphData(const wchar_t glyph) const = 0;
|
||||
virtual GlyphData * getGlyphData(unsigned short glyph) const = 0;
|
||||
|
||||
|
||||
}; // FontData
|
||||
}; // Rasterizer
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#include "Font.h"
|
||||
|
||||
#include "TrueTypeRasterizer.h"
|
||||
#include <font/ImageRasterizer.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
namespace freetype
|
||||
{
|
||||
Font::Font()
|
||||
{
|
||||
if(FT_Init_FreeType(&library))
|
||||
throw love::Exception("TrueTypeFont Loading error: FT_Init_FreeType failed\n");
|
||||
}
|
||||
|
||||
Font::~Font()
|
||||
{
|
||||
FT_Done_FreeType(library);
|
||||
}
|
||||
|
||||
Rasterizer * Font::newRasterizer(Data * data, int size)
|
||||
{
|
||||
return new TrueTypeRasterizer(library, data, size);
|
||||
}
|
||||
|
||||
Rasterizer * Font::newRasterizer(love::image::ImageData * data, unsigned short * glyphs)
|
||||
{
|
||||
return new ImageRasterizer(data, glyphs);
|
||||
}
|
||||
|
||||
GlyphData * Font::newGlyphData(Rasterizer * r, unsigned short glyph)
|
||||
{
|
||||
return r->getGlyphData(glyph);
|
||||
}
|
||||
|
||||
const char * Font::getName() const
|
||||
{
|
||||
return "love.font.freetype";
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_FONT_FREETYPE_FONT_H
|
||||
#define LOVE_FONT_FREETYPE_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include <filesystem/File.h>
|
||||
#include <font/Rasterizer.h>
|
||||
#include <image/ImageData.h>
|
||||
#include <common/Module.h>
|
||||
|
||||
// FreeType2
|
||||
#include <ft2build.h>
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
#include <freetype/ftoutln.h>
|
||||
#include <freetype/fttrigon.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
namespace freetype
|
||||
{
|
||||
|
||||
class Font : public Module
|
||||
{
|
||||
private:
|
||||
|
||||
// FreeType library
|
||||
FT_Library library;
|
||||
|
||||
public:
|
||||
|
||||
Font();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
virtual ~Font();
|
||||
|
||||
Rasterizer * newRasterizer(Data * data, int size);
|
||||
Rasterizer * newRasterizer(love::image::ImageData * data, unsigned short * glyphs);
|
||||
GlyphData * newGlyphData(Rasterizer * r, unsigned short glyph);
|
||||
|
||||
// Implement Module
|
||||
const char * getName() const;
|
||||
|
||||
}; // Font
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREETYPE_FONT_H
|
||||
+21
-30
@@ -19,7 +19,7 @@
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "FreeTypeRasterizer.h"
|
||||
#include "TrueTypeRasterizer.h"
|
||||
|
||||
#include <common/Exception.h>
|
||||
|
||||
@@ -29,20 +29,12 @@ namespace font
|
||||
{
|
||||
namespace freetype
|
||||
{
|
||||
inline int next_p2(int num)
|
||||
{
|
||||
int powered = 2;
|
||||
while(powered < num) powered <<= 1;
|
||||
return powered;
|
||||
}
|
||||
struct la { unsigned char l,a; };
|
||||
|
||||
FreeTypeRasterizer::FreeTypeRasterizer(love::filesystem::File * file, int size)
|
||||
TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data * data, int size)
|
||||
: data(data)
|
||||
{
|
||||
// Initialize
|
||||
data = file->read();
|
||||
|
||||
if(FT_Init_FreeType(&library))
|
||||
throw love::Exception("TrueTypeFont Loading error: FT_Init_FreeType failed\n");
|
||||
data->retain();
|
||||
|
||||
if(FT_New_Memory_Face( library,
|
||||
(const FT_Byte *)data->getData(), /* first byte in memory */
|
||||
@@ -60,23 +52,20 @@ namespace freetype
|
||||
metrics.height = face->height;
|
||||
}
|
||||
|
||||
FreeTypeRasterizer::~FreeTypeRasterizer()
|
||||
TrueTypeRasterizer::~TrueTypeRasterizer()
|
||||
{
|
||||
FT_Done_Face(face);
|
||||
FT_Done_FreeType(library);
|
||||
data->release();
|
||||
}
|
||||
|
||||
int FreeTypeRasterizer::getLineHeight() const
|
||||
int TrueTypeRasterizer::getLineHeight() const
|
||||
{
|
||||
return (int)(getHeight() * 1.25);
|
||||
}
|
||||
|
||||
GlyphData * FreeTypeRasterizer::getGlyphData(const wchar_t glyph) const
|
||||
GlyphData * TrueTypeRasterizer::getGlyphData(unsigned short glyph) const
|
||||
{
|
||||
unsigned char * textureData;
|
||||
love::font::GlyphMetrics glyphMetrics;
|
||||
int bpp = 2;
|
||||
FT_Glyph ftglyph;
|
||||
|
||||
// Initialize
|
||||
@@ -85,7 +74,7 @@ namespace freetype
|
||||
|
||||
if( FT_Get_Glyph(face->glyph, &ftglyph) )
|
||||
throw love::Exception("TrueTypeFont Loading vm->error: FT_Get_Glyph failed\n");
|
||||
|
||||
|
||||
FT_Glyph_To_Bitmap(&ftglyph, FT_RENDER_MODE_NORMAL, 0, 1);
|
||||
FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph)ftglyph;
|
||||
FT_Bitmap& bitmap = bitmap_glyph->bitmap; //just to make things easier
|
||||
@@ -93,23 +82,25 @@ namespace freetype
|
||||
// Get metrics
|
||||
glyphMetrics.bearingX = face->glyph->metrics.horiBearingX;
|
||||
glyphMetrics.bearingY = face->glyph->metrics.horiBearingY;
|
||||
glyphMetrics.height = face->glyph->metrics.height;
|
||||
glyphMetrics.width = face->glyph->metrics.width;
|
||||
glyphMetrics.height = bitmap.rows;
|
||||
glyphMetrics.width = bitmap.width;
|
||||
glyphMetrics.advance = face->glyph->advance.x >> 6;
|
||||
|
||||
// Get texture
|
||||
int w = next_p2(bitmap.width);
|
||||
int h = next_p2(bitmap.rows);
|
||||
textureData = new unsigned char[bpp * w * h];
|
||||
GlyphData * glyphData = new GlyphData(glyph, glyphMetrics);
|
||||
|
||||
for(int j = 0; j < h; j++) for(int i = 0; i < w; i++)
|
||||
{
|
||||
textureData[bpp * (i + j * w)] = 255;
|
||||
textureData[bpp * (i + j * w) + 1] = (i >= bitmap.width || j >= bitmap.rows) ? 0 : bitmap.buffer[i + bitmap.width * j];
|
||||
int size = bitmap.rows*bitmap.width;
|
||||
unsigned char * dst = (unsigned char *)glyphData->getData();
|
||||
|
||||
// Note that bitmap.buffer contains only luminocity. We copy that single value to
|
||||
// our luminocity-alpha format.
|
||||
for(int i = 0; i<size; i++)
|
||||
{
|
||||
dst[2*i] = dst[2*i+1] = bitmap.buffer[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Return data
|
||||
GlyphData * glyphData = new GlyphData(glyph, textureData, glyphMetrics, bpp);
|
||||
return glyphData;
|
||||
}
|
||||
|
||||
+11
-13
@@ -18,14 +18,14 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_FONT_FREE_TYPE_RASTERIZER_H
|
||||
#define LOVE_FONT_FREE_TYPE_RASTERIZER_H
|
||||
#ifndef LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
#define LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include <filesystem/File.h>
|
||||
#include <font/Rasterizer.h>
|
||||
|
||||
// FreeType2
|
||||
// TrueType2
|
||||
#include <ft2build.h>
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
@@ -41,26 +41,24 @@ namespace freetype
|
||||
/**
|
||||
* Holds data for a font object.
|
||||
**/
|
||||
class FreeTypeRasterizer : public Rasterizer
|
||||
class TrueTypeRasterizer : public Rasterizer
|
||||
{
|
||||
private:
|
||||
// FreeType library
|
||||
FT_Library library;
|
||||
|
||||
// FreeType face
|
||||
|
||||
// TrueType face
|
||||
FT_Face face;
|
||||
|
||||
// File data
|
||||
Data * data;
|
||||
|
||||
|
||||
public:
|
||||
FreeTypeRasterizer(love::filesystem::File * file, int size);
|
||||
virtual ~FreeTypeRasterizer();
|
||||
TrueTypeRasterizer(FT_Library library, Data * data, int size);
|
||||
virtual ~TrueTypeRasterizer();
|
||||
|
||||
// Implement FontData
|
||||
// Implement Rasterizer
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData * getGlyphData(const wchar_t glyph) const;
|
||||
virtual GlyphData * getGlyphData(unsigned short glyph) const;
|
||||
|
||||
}; // FreetypeRasterizer
|
||||
|
||||
@@ -68,4 +66,4 @@ namespace freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREE_TYPE_RASTERIZER_H
|
||||
#endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
@@ -20,27 +20,49 @@
|
||||
|
||||
#include "wrap_Font.h"
|
||||
|
||||
#include <font/wrap_GlyphData.h>
|
||||
#include <font/wrap_Rasterizer.h>
|
||||
|
||||
#include "TrueTypeRasterizer.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
namespace freetype
|
||||
{
|
||||
static Font * instance = 0;
|
||||
|
||||
int _wrap_test(lua_State * L)
|
||||
int _wrap_newRasterizer(lua_State * L)
|
||||
{
|
||||
lua_pushinteger(L, 696);
|
||||
Data * d = luax_checkdata(L, 1);
|
||||
int size = luaL_checkint(L, 2);
|
||||
|
||||
Rasterizer * t = instance->newRasterizer(d, size);
|
||||
luax_newtype(L, "Rasterizer", LOVE_FONT_RASTERIZER_BITS, t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _wrap_newGlyphData(lua_State * L)
|
||||
{
|
||||
Rasterizer * r = luax_checkrasterizer(L, 1);
|
||||
unsigned short g = (unsigned short)luaL_checkint(L, 2);
|
||||
|
||||
GlyphData * t = instance->newGlyphData(r, g);
|
||||
luax_newtype(L, "GlyphData", LOVE_FONT_GLYPH_DATA_BITS, t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg wrap_Font_functions[] = {
|
||||
{ "test", _wrap_test },
|
||||
{ "newRasterizer", _wrap_newRasterizer },
|
||||
{ "newGlyphData", _wrap_newGlyphData },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction wrap_Font_types[] = {
|
||||
_wrap_test,
|
||||
wrap_GlyphData_open,
|
||||
wrap_Rasterizer_open,
|
||||
0
|
||||
};
|
||||
|
||||
@@ -63,5 +85,6 @@ namespace font
|
||||
return luax_register_module(L, wrap_Font_functions, wrap_Font_types, "font");
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // sound
|
||||
} // love
|
||||
@@ -18,8 +18,8 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_FONT_WRAP_FONT_H
|
||||
#define LOVE_FONT_WRAP_FONT_H
|
||||
#ifndef LOVE_FONT_FREETYPE_WRAP_FONT_H
|
||||
#define LOVE_FONT_FREETYPE_WRAP_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include "Font.h"
|
||||
@@ -29,10 +29,14 @@ namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
int _wrap_test(lua_State * L);
|
||||
namespace freetype
|
||||
{
|
||||
int _wrap_newRasterizer(lua_State * L);
|
||||
int _wrap_newGlyphData(lua_State * L);
|
||||
int wrap_Font_open(lua_State * L);
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_SOUND_WRAP_FONT_H
|
||||
#endif // LOVE_FONT_FREETYPE_WRAP_FONT_H
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#include "wrap_GlyphData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
GlyphData * luax_checkglyphdata(lua_State * L, int idx)
|
||||
{
|
||||
return luax_checktype<GlyphData>(L, idx, "GlyphData", LOVE_FONT_GLYPH_DATA_BITS);
|
||||
}
|
||||
|
||||
static const luaL_Reg wrap_GlyphData_functions[] = {
|
||||
|
||||
// Data
|
||||
{ "getPointer", _wrap_Data_getPointer },
|
||||
{ "getSize", _wrap_Data_getSize },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int wrap_GlyphData_open(lua_State * L)
|
||||
{
|
||||
luax_register_type(L, "GlyphData", wrap_GlyphData_functions);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // sound
|
||||
} // love
|
||||
@@ -16,40 +16,25 @@
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_FONT_FONT_H
|
||||
#define LOVE_FONT_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
#include <filesystem/File.h>
|
||||
#include "Rasterizer.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
/**
|
||||
* The Font module is responsible for decoding font data. It is
|
||||
* not responsible for drawing it.
|
||||
**/
|
||||
class Font : public Module
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
virtual ~Font();
|
||||
|
||||
// Implement Module
|
||||
const char * getName() const;
|
||||
|
||||
}; // Font
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FONT_H
|
||||
**/
|
||||
|
||||
#ifndef LOVE_FONT_WRAP_GLYPH_DATA_H
|
||||
#define LOVE_FONT_WRAP_GLYPH_DATA_H
|
||||
|
||||
// LOVE
|
||||
#include <common/runtime.h>
|
||||
#include <common/wrap_Data.h>
|
||||
|
||||
#include "GlyphData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
GlyphData * luax_checkglyphdata(lua_State * L, int idx);
|
||||
int wrap_GlyphData_open(lua_State * L);
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_WRAP_GLYPH_DATA_H
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#include "wrap_Rasterizer.h"
|
||||
|
||||
#include <common/wrap_Data.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
Rasterizer * luax_checkrasterizer(lua_State * L, int idx)
|
||||
{
|
||||
return luax_checktype<Rasterizer>(L, idx, "Rasterizer", LOVE_FONT_RASTERIZER_BITS);
|
||||
}
|
||||
|
||||
static const luaL_Reg wrap_Rasterizer_functions[] = {
|
||||
|
||||
// Data
|
||||
{ "getPointer", _wrap_Data_getPointer },
|
||||
{ "getSize", _wrap_Data_getSize },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int wrap_Rasterizer_open(lua_State * L)
|
||||
{
|
||||
luax_register_type(L, "Rasterizer", wrap_Rasterizer_functions);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
@@ -16,23 +16,23 @@
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#include "Font.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
Font::~Font()
|
||||
{
|
||||
}
|
||||
|
||||
const char * Font::getName() const
|
||||
{
|
||||
return "love.font";
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
**/
|
||||
|
||||
#ifndef LOVE_FONT_WRAP_RASTERIZER_H
|
||||
#define LOVE_FONT_WRAP_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include <common/runtime.h>
|
||||
#include "Rasterizer.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
Rasterizer * luax_checkrasterizer(lua_State * L, int idx);
|
||||
int wrap_Rasterizer_open(lua_State * L);
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_WRAP_RASTERIZER_H
|
||||
Reference in New Issue
Block a user