mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
trashed old unnecessary font stuff - compiles, but obviously will not work yet
--HG-- branch : newfont
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#define LOVE_FONT_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include "FontData.h"
|
||||
#include "Rasterizer.h"
|
||||
#include <image/ImageData.h>
|
||||
#include <common/Module.h>
|
||||
@@ -44,7 +43,6 @@ namespace font
|
||||
virtual Rasterizer * newRasterizer(love::image::ImageData * data, std::string glyphs) = 0;
|
||||
virtual Rasterizer * newRasterizer(love::image::ImageData * data, unsigned short * glyphs, int length) = 0;
|
||||
virtual GlyphData * newGlyphData(Rasterizer * r, unsigned short glyph) = 0;
|
||||
virtual FontData * newFontData(Rasterizer * r) = 0;
|
||||
|
||||
// Implement Module
|
||||
virtual const char * getName() const = 0;
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 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 "FontData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
FontData::FontData(Rasterizer * raster)
|
||||
: raster(raster)
|
||||
{
|
||||
data = new GlyphData *[MAX_CHARS];
|
||||
for (unsigned int i = 0; i < MAX_CHARS; i++) {
|
||||
data[i] = raster->getGlyphData(i);
|
||||
}
|
||||
}
|
||||
|
||||
FontData::~FontData()
|
||||
{
|
||||
for (unsigned int i = 0; i < MAX_CHARS; i++) {
|
||||
data[i]->release();
|
||||
}
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
void * FontData::getData() const
|
||||
{
|
||||
return (void *)data;
|
||||
}
|
||||
|
||||
int FontData::getSize() const
|
||||
{
|
||||
return MAX_CHARS;
|
||||
}
|
||||
|
||||
GlyphData * FontData::getGlyphData(unsigned short glyph) const
|
||||
{
|
||||
return data[glyph];
|
||||
}
|
||||
|
||||
int FontData::getHeight() const
|
||||
{
|
||||
return raster->getHeight();
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
@@ -1,56 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 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_FONT_DATA_H
|
||||
#define LOVE_FONT_FONT_DATA_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Data.h>
|
||||
|
||||
#include "GlyphData.h"
|
||||
#include "Rasterizer.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
class FontData : public Data
|
||||
{
|
||||
public:
|
||||
FontData(Rasterizer * raster);
|
||||
virtual ~FontData();
|
||||
|
||||
// Implements Data.
|
||||
void * getData() const;
|
||||
int getSize() const;
|
||||
|
||||
GlyphData * getGlyphData(unsigned short glyph) const;
|
||||
int getHeight() const;
|
||||
|
||||
static const unsigned int MAX_CHARS = 256;
|
||||
|
||||
private:
|
||||
GlyphData ** data;
|
||||
Rasterizer * raster;
|
||||
};
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FONT_DATA_H
|
||||
@@ -66,11 +66,6 @@ namespace freetype
|
||||
{
|
||||
return r->getGlyphData(glyph);
|
||||
}
|
||||
|
||||
FontData * Font::newFontData(Rasterizer * r)
|
||||
{
|
||||
return new FontData(r);
|
||||
}
|
||||
|
||||
const char * Font::getName() const
|
||||
{
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace freetype
|
||||
Rasterizer * newRasterizer(love::image::ImageData * data, std::string glyphs);
|
||||
Rasterizer * newRasterizer(love::image::ImageData * data, unsigned short * glyphs, int length);
|
||||
GlyphData * newGlyphData(Rasterizer * r, unsigned short glyph);
|
||||
FontData * newFontData(Rasterizer * r);
|
||||
|
||||
// Implement Module
|
||||
const char * getName() const;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "Font.h"
|
||||
|
||||
#include <font/wrap_FontData.h>
|
||||
#include <font/wrap_GlyphData.h>
|
||||
#include <font/wrap_Rasterizer.h>
|
||||
|
||||
@@ -64,25 +63,15 @@ namespace freetype
|
||||
luax_newtype(L, "GlyphData", FONT_GLYPH_DATA_T, t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_newFontData(lua_State * L)
|
||||
{
|
||||
Rasterizer * r = luax_checkrasterizer(L, 1);
|
||||
FontData * f = instance->newFontData(r);
|
||||
luax_newtype(L, "FontData", FONT_FONT_DATA_T, (void*)f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "newRasterizer", w_newRasterizer },
|
||||
{ "newGlyphData", w_newGlyphData },
|
||||
{ "newFontData", w_newFontData },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_fontdata,
|
||||
luaopen_glyphdata,
|
||||
luaopen_rasterizer,
|
||||
0
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 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_FontData.h"
|
||||
|
||||
#include <common/wrap_Data.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
FontData * luax_checkfontdata(lua_State * L, int idx)
|
||||
{
|
||||
return luax_checktype<FontData>(L, idx, "FontData", FONT_FONT_DATA_T);
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int luaopen_fontdata(lua_State * L)
|
||||
{
|
||||
return luax_register_type(L, "FontData", functions);
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 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_WRAP_FONT_DATA_H
|
||||
#define LOVE_FONT_WRAP_FONT_DATA_H
|
||||
|
||||
// LOVE
|
||||
#include <common/runtime.h>
|
||||
|
||||
#include "FontData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
FontData * luax_checkfontdata(lua_State * L, int idx);
|
||||
int luaopen_fontdata(lua_State * L);
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_WRAP_FONT_DATA_H
|
||||
Reference in New Issue
Block a user