mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
CRLF to LF
This commit is contained in:
+54
-54
@@ -1,55 +1,55 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_H
|
||||
#define LOVE_FONT_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include "Rasterizer.h"
|
||||
#include "image/ImageData.h"
|
||||
#include "common/Module.h"
|
||||
|
||||
// STD
|
||||
#include <string>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
class Font : public Module
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual Rasterizer *newRasterizer(Data *data, int size) = 0;
|
||||
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;
|
||||
|
||||
// Implement Module
|
||||
virtual const char *getName() const = 0;
|
||||
|
||||
}; // Font
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_H
|
||||
#define LOVE_FONT_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include "Rasterizer.h"
|
||||
#include "image/ImageData.h"
|
||||
#include "common/Module.h"
|
||||
|
||||
// STD
|
||||
#include <string>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
class Font : public Module
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual Rasterizer *newRasterizer(Data *data, int size) = 0;
|
||||
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;
|
||||
|
||||
// Implement Module
|
||||
virtual const char *getName() const = 0;
|
||||
|
||||
}; // Font
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FONT_H
|
||||
+127
-127
@@ -1,127 +1,127 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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 "GlyphData.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
GlyphData::GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics, GlyphData::Format f)
|
||||
: glyph(glyph)
|
||||
, metrics(glyphMetrics)
|
||||
, data(0)
|
||||
, format(f)
|
||||
{
|
||||
if (metrics.width && metrics.height)
|
||||
{
|
||||
switch (f)
|
||||
{
|
||||
case GlyphData::FORMAT_LUMINANCE_ALPHA:
|
||||
data = new unsigned char[metrics.width * metrics.height * 2];
|
||||
break;
|
||||
case GlyphData::FORMAT_RGBA:
|
||||
default:
|
||||
data = new unsigned char[metrics.width * metrics.height * 4];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlyphData::~GlyphData()
|
||||
{
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
void *GlyphData::getData() const
|
||||
{
|
||||
return (void *) data;
|
||||
}
|
||||
|
||||
int GlyphData::getSize() const
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case GlyphData::FORMAT_LUMINANCE_ALPHA:
|
||||
return getWidth() * getHeight() * 2;
|
||||
break;
|
||||
case GlyphData::FORMAT_RGBA:
|
||||
default:
|
||||
return getWidth() * getHeight() * 4;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int GlyphData::getHeight() const
|
||||
{
|
||||
return metrics.height;
|
||||
}
|
||||
|
||||
int GlyphData::getWidth() const
|
||||
{
|
||||
return metrics.width;
|
||||
}
|
||||
|
||||
int GlyphData::getAdvance() const
|
||||
{
|
||||
return metrics.advance;
|
||||
}
|
||||
|
||||
int GlyphData::getBearingX() const
|
||||
{
|
||||
return metrics.bearingX;
|
||||
}
|
||||
|
||||
int GlyphData::getBearingY() const
|
||||
{
|
||||
return metrics.bearingY;
|
||||
}
|
||||
|
||||
int GlyphData::getMinX() const
|
||||
{
|
||||
return this->getBearingX();
|
||||
}
|
||||
|
||||
int GlyphData::getMinY() const
|
||||
{
|
||||
return this->getHeight() - this->getBearingY();
|
||||
}
|
||||
|
||||
int GlyphData::getMaxX() const
|
||||
{
|
||||
return this->getBearingX() + this->getWidth();
|
||||
}
|
||||
|
||||
int GlyphData::getMaxY() const
|
||||
{
|
||||
return this->getBearingY();
|
||||
}
|
||||
|
||||
GlyphData::Format GlyphData::getFormat() const
|
||||
{
|
||||
return format;
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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 "GlyphData.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
GlyphData::GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics, GlyphData::Format f)
|
||||
: glyph(glyph)
|
||||
, metrics(glyphMetrics)
|
||||
, data(0)
|
||||
, format(f)
|
||||
{
|
||||
if (metrics.width && metrics.height)
|
||||
{
|
||||
switch (f)
|
||||
{
|
||||
case GlyphData::FORMAT_LUMINANCE_ALPHA:
|
||||
data = new unsigned char[metrics.width * metrics.height * 2];
|
||||
break;
|
||||
case GlyphData::FORMAT_RGBA:
|
||||
default:
|
||||
data = new unsigned char[metrics.width * metrics.height * 4];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlyphData::~GlyphData()
|
||||
{
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
void *GlyphData::getData() const
|
||||
{
|
||||
return (void *) data;
|
||||
}
|
||||
|
||||
int GlyphData::getSize() const
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case GlyphData::FORMAT_LUMINANCE_ALPHA:
|
||||
return getWidth() * getHeight() * 2;
|
||||
break;
|
||||
case GlyphData::FORMAT_RGBA:
|
||||
default:
|
||||
return getWidth() * getHeight() * 4;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int GlyphData::getHeight() const
|
||||
{
|
||||
return metrics.height;
|
||||
}
|
||||
|
||||
int GlyphData::getWidth() const
|
||||
{
|
||||
return metrics.width;
|
||||
}
|
||||
|
||||
int GlyphData::getAdvance() const
|
||||
{
|
||||
return metrics.advance;
|
||||
}
|
||||
|
||||
int GlyphData::getBearingX() const
|
||||
{
|
||||
return metrics.bearingX;
|
||||
}
|
||||
|
||||
int GlyphData::getBearingY() const
|
||||
{
|
||||
return metrics.bearingY;
|
||||
}
|
||||
|
||||
int GlyphData::getMinX() const
|
||||
{
|
||||
return this->getBearingX();
|
||||
}
|
||||
|
||||
int GlyphData::getMinY() const
|
||||
{
|
||||
return this->getHeight() - this->getBearingY();
|
||||
}
|
||||
|
||||
int GlyphData::getMaxX() const
|
||||
{
|
||||
return this->getBearingX() + this->getWidth();
|
||||
}
|
||||
|
||||
int GlyphData::getMaxY() const
|
||||
{
|
||||
return this->getBearingY();
|
||||
}
|
||||
|
||||
GlyphData::Format GlyphData::getFormat() const
|
||||
{
|
||||
return format;
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
+134
-134
@@ -1,134 +1,134 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_GLYPH_DATA_H
|
||||
#define LOVE_FONT_GLYPH_DATA_H
|
||||
|
||||
// LOVE
|
||||
#include "common/config.h"
|
||||
#include "common/Data.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds the specific glyph data.
|
||||
**/
|
||||
struct GlyphMetrics
|
||||
{
|
||||
int height;
|
||||
int width;
|
||||
int advance;
|
||||
int bearingX;
|
||||
int bearingY;
|
||||
int spacing;
|
||||
};
|
||||
|
||||
/**
|
||||
* Holds data for a specic glyph object.
|
||||
**/
|
||||
class GlyphData : public Data
|
||||
{
|
||||
|
||||
public:
|
||||
enum Format
|
||||
{
|
||||
FORMAT_LUMINANCE_ALPHA,
|
||||
FORMAT_RGBA
|
||||
};
|
||||
|
||||
GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics, Format f);
|
||||
virtual ~GlyphData();
|
||||
|
||||
// Implements Data.
|
||||
void *getData() const;
|
||||
int getSize() const;
|
||||
|
||||
/**
|
||||
* Gets the height of the glyph.
|
||||
**/
|
||||
virtual int getHeight() const;
|
||||
|
||||
/**
|
||||
* Gets the width of the glyph.
|
||||
**/
|
||||
virtual int getWidth() const;
|
||||
|
||||
/**
|
||||
* Gets the advance (the space the glyph takes up) of the glyph.
|
||||
**/
|
||||
int getAdvance() const;
|
||||
|
||||
/**
|
||||
* Gets bearing (the spacing from origin) along the x-axis of the glyph.
|
||||
**/
|
||||
int getBearingX() const;
|
||||
|
||||
/**
|
||||
* Gets bearing (the spacing from origin) along the y-axis of the glyph.
|
||||
**/
|
||||
int getBearingY() const;
|
||||
|
||||
/**
|
||||
* Gets the min x value of the glyph.
|
||||
**/
|
||||
int getMinX() const;
|
||||
|
||||
/**
|
||||
* Gets the min y value of the glyph.
|
||||
**/
|
||||
int getMinY() const;
|
||||
|
||||
/**
|
||||
* Gets the max x value of the glyph.
|
||||
**/
|
||||
int getMaxX() const;
|
||||
|
||||
/**
|
||||
* Gets the max y value of the glyph.
|
||||
**/
|
||||
int getMaxY() const;
|
||||
|
||||
/**
|
||||
* Gets the format of the glyph data.
|
||||
**/
|
||||
Format getFormat() const;
|
||||
|
||||
private:
|
||||
// The glyph itself
|
||||
unsigned short glyph;
|
||||
|
||||
// Glyph metrics
|
||||
GlyphMetrics metrics;
|
||||
|
||||
// Glyph texture data
|
||||
unsigned char *data;
|
||||
|
||||
// The format the data's in
|
||||
Format format;
|
||||
|
||||
}; // GlyphData
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_GLYPH_DATA_H
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_GLYPH_DATA_H
|
||||
#define LOVE_FONT_GLYPH_DATA_H
|
||||
|
||||
// LOVE
|
||||
#include "common/config.h"
|
||||
#include "common/Data.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds the specific glyph data.
|
||||
**/
|
||||
struct GlyphMetrics
|
||||
{
|
||||
int height;
|
||||
int width;
|
||||
int advance;
|
||||
int bearingX;
|
||||
int bearingY;
|
||||
int spacing;
|
||||
};
|
||||
|
||||
/**
|
||||
* Holds data for a specic glyph object.
|
||||
**/
|
||||
class GlyphData : public Data
|
||||
{
|
||||
|
||||
public:
|
||||
enum Format
|
||||
{
|
||||
FORMAT_LUMINANCE_ALPHA,
|
||||
FORMAT_RGBA
|
||||
};
|
||||
|
||||
GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics, Format f);
|
||||
virtual ~GlyphData();
|
||||
|
||||
// Implements Data.
|
||||
void *getData() const;
|
||||
int getSize() const;
|
||||
|
||||
/**
|
||||
* Gets the height of the glyph.
|
||||
**/
|
||||
virtual int getHeight() const;
|
||||
|
||||
/**
|
||||
* Gets the width of the glyph.
|
||||
**/
|
||||
virtual int getWidth() const;
|
||||
|
||||
/**
|
||||
* Gets the advance (the space the glyph takes up) of the glyph.
|
||||
**/
|
||||
int getAdvance() const;
|
||||
|
||||
/**
|
||||
* Gets bearing (the spacing from origin) along the x-axis of the glyph.
|
||||
**/
|
||||
int getBearingX() const;
|
||||
|
||||
/**
|
||||
* Gets bearing (the spacing from origin) along the y-axis of the glyph.
|
||||
**/
|
||||
int getBearingY() const;
|
||||
|
||||
/**
|
||||
* Gets the min x value of the glyph.
|
||||
**/
|
||||
int getMinX() const;
|
||||
|
||||
/**
|
||||
* Gets the min y value of the glyph.
|
||||
**/
|
||||
int getMinY() const;
|
||||
|
||||
/**
|
||||
* Gets the max x value of the glyph.
|
||||
**/
|
||||
int getMaxX() const;
|
||||
|
||||
/**
|
||||
* Gets the max y value of the glyph.
|
||||
**/
|
||||
int getMaxY() const;
|
||||
|
||||
/**
|
||||
* Gets the format of the glyph data.
|
||||
**/
|
||||
Format getFormat() const;
|
||||
|
||||
private:
|
||||
// The glyph itself
|
||||
unsigned short glyph;
|
||||
|
||||
// Glyph metrics
|
||||
GlyphMetrics metrics;
|
||||
|
||||
// Glyph texture data
|
||||
unsigned char *data;
|
||||
|
||||
// The format the data's in
|
||||
Format format;
|
||||
|
||||
}; // GlyphData
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_GLYPH_DATA_H
|
||||
|
||||
@@ -1,153 +1,153 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "ImageRasterizer.h"
|
||||
|
||||
#include "common/Exception.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
inline bool equal(const love::image::pixel &a, const love::image::pixel &b)
|
||||
{
|
||||
return (a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a);
|
||||
}
|
||||
|
||||
ImageRasterizer::ImageRasterizer(love::image::ImageData *data, unsigned short *glyphs, int length)
|
||||
: imageData(data)
|
||||
, glyphs(glyphs)
|
||||
, length(length)
|
||||
{
|
||||
imageData->retain();
|
||||
positions = new unsigned int[MAX_CHARS];
|
||||
memset(positions, 0, MAX_CHARS*4);
|
||||
widths = new unsigned int[MAX_CHARS];
|
||||
memset(widths, 0, MAX_CHARS*4);
|
||||
spacing = new unsigned int[MAX_CHARS];
|
||||
memset(spacing, 0, MAX_CHARS*4);
|
||||
load();
|
||||
}
|
||||
|
||||
ImageRasterizer::~ImageRasterizer()
|
||||
{
|
||||
imageData->release();
|
||||
delete[] positions;
|
||||
delete[] widths;
|
||||
delete[] spacing;
|
||||
}
|
||||
|
||||
int ImageRasterizer::getLineHeight() const
|
||||
{
|
||||
return getHeight();
|
||||
}
|
||||
|
||||
GlyphData *ImageRasterizer::getGlyphData(unsigned short glyph) const
|
||||
{
|
||||
GlyphMetrics gm;
|
||||
gm.height = metrics.height;
|
||||
gm.width = widths[glyph];
|
||||
gm.advance = spacing[glyph] + widths[glyph];
|
||||
gm.bearingX = 0;
|
||||
gm.bearingY = 0;
|
||||
GlyphData *g = new GlyphData(glyph, gm, GlyphData::FORMAT_RGBA);
|
||||
if (gm.width == 0) return g;
|
||||
unsigned char *gd = (unsigned char *)g->getData();
|
||||
love::image::pixel *pixels = (love::image::pixel *)(imageData->getData());
|
||||
for (unsigned int i = 0; i < widths[glyph]*getHeight(); i++)
|
||||
{
|
||||
love::image::pixel p = pixels[ positions[glyph] + (i % widths[glyph]) + (imageData->getWidth() * (i / widths[glyph])) ];
|
||||
gd[i*4] = p.r;
|
||||
gd[i*4+1] = p.g;
|
||||
gd[i*4+2] = p.b;
|
||||
gd[i*4+3] = p.a;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
void ImageRasterizer::load()
|
||||
{
|
||||
love::image::pixel *pixels = (love::image::pixel *)(imageData->getData());
|
||||
|
||||
unsigned imgw = (unsigned)imageData->getWidth();
|
||||
unsigned imgh = (unsigned)imageData->getHeight();
|
||||
unsigned imgs = imgw*imgh;
|
||||
|
||||
// Set the only metric that matters
|
||||
metrics.height = imgh;
|
||||
|
||||
// Reading texture data begins
|
||||
love::image::pixel spacer = pixels[0];
|
||||
|
||||
unsigned int start = 0;
|
||||
unsigned int end = 0;
|
||||
|
||||
for (unsigned int i = 0; i < length; ++i)
|
||||
{
|
||||
if (i >= MAX_CHARS)
|
||||
break;
|
||||
|
||||
start = end;
|
||||
|
||||
// Finds out where the first character starts
|
||||
while (start < imgw && equal(pixels[start], spacer))
|
||||
++start;
|
||||
|
||||
if (i > 0)
|
||||
spacing[glyphs[i - 1]] = (start > end) ? (start - end) : 0;
|
||||
|
||||
end = start;
|
||||
|
||||
// Find where glyph ends.
|
||||
while (end < imgw && !equal(pixels[end], spacer))
|
||||
++end;
|
||||
|
||||
if (start >= end)
|
||||
break;
|
||||
|
||||
unsigned c = glyphs[i];
|
||||
|
||||
positions[c] = start;
|
||||
widths[c] = (end - start);
|
||||
}
|
||||
|
||||
// Replace spacer color with an empty pixel
|
||||
for (unsigned int i = 0; i < imgs; ++i)
|
||||
{
|
||||
if (equal(pixels[i], spacer))
|
||||
{
|
||||
pixels[i].r = 0;
|
||||
pixels[i].g = 0;
|
||||
pixels[i].b = 0;
|
||||
pixels[i].a = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ImageRasterizer::getNumGlyphs() const
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "ImageRasterizer.h"
|
||||
|
||||
#include "common/Exception.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
inline bool equal(const love::image::pixel &a, const love::image::pixel &b)
|
||||
{
|
||||
return (a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a);
|
||||
}
|
||||
|
||||
ImageRasterizer::ImageRasterizer(love::image::ImageData *data, unsigned short *glyphs, int length)
|
||||
: imageData(data)
|
||||
, glyphs(glyphs)
|
||||
, length(length)
|
||||
{
|
||||
imageData->retain();
|
||||
positions = new unsigned int[MAX_CHARS];
|
||||
memset(positions, 0, MAX_CHARS*4);
|
||||
widths = new unsigned int[MAX_CHARS];
|
||||
memset(widths, 0, MAX_CHARS*4);
|
||||
spacing = new unsigned int[MAX_CHARS];
|
||||
memset(spacing, 0, MAX_CHARS*4);
|
||||
load();
|
||||
}
|
||||
|
||||
ImageRasterizer::~ImageRasterizer()
|
||||
{
|
||||
imageData->release();
|
||||
delete[] positions;
|
||||
delete[] widths;
|
||||
delete[] spacing;
|
||||
}
|
||||
|
||||
int ImageRasterizer::getLineHeight() const
|
||||
{
|
||||
return getHeight();
|
||||
}
|
||||
|
||||
GlyphData *ImageRasterizer::getGlyphData(unsigned short glyph) const
|
||||
{
|
||||
GlyphMetrics gm;
|
||||
gm.height = metrics.height;
|
||||
gm.width = widths[glyph];
|
||||
gm.advance = spacing[glyph] + widths[glyph];
|
||||
gm.bearingX = 0;
|
||||
gm.bearingY = 0;
|
||||
GlyphData *g = new GlyphData(glyph, gm, GlyphData::FORMAT_RGBA);
|
||||
if (gm.width == 0) return g;
|
||||
unsigned char *gd = (unsigned char *)g->getData();
|
||||
love::image::pixel *pixels = (love::image::pixel *)(imageData->getData());
|
||||
for (unsigned int i = 0; i < widths[glyph]*getHeight(); i++)
|
||||
{
|
||||
love::image::pixel p = pixels[ positions[glyph] + (i % widths[glyph]) + (imageData->getWidth() * (i / widths[glyph])) ];
|
||||
gd[i*4] = p.r;
|
||||
gd[i*4+1] = p.g;
|
||||
gd[i*4+2] = p.b;
|
||||
gd[i*4+3] = p.a;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
void ImageRasterizer::load()
|
||||
{
|
||||
love::image::pixel *pixels = (love::image::pixel *)(imageData->getData());
|
||||
|
||||
unsigned imgw = (unsigned)imageData->getWidth();
|
||||
unsigned imgh = (unsigned)imageData->getHeight();
|
||||
unsigned imgs = imgw*imgh;
|
||||
|
||||
// Set the only metric that matters
|
||||
metrics.height = imgh;
|
||||
|
||||
// Reading texture data begins
|
||||
love::image::pixel spacer = pixels[0];
|
||||
|
||||
unsigned int start = 0;
|
||||
unsigned int end = 0;
|
||||
|
||||
for (unsigned int i = 0; i < length; ++i)
|
||||
{
|
||||
if (i >= MAX_CHARS)
|
||||
break;
|
||||
|
||||
start = end;
|
||||
|
||||
// Finds out where the first character starts
|
||||
while (start < imgw && equal(pixels[start], spacer))
|
||||
++start;
|
||||
|
||||
if (i > 0)
|
||||
spacing[glyphs[i - 1]] = (start > end) ? (start - end) : 0;
|
||||
|
||||
end = start;
|
||||
|
||||
// Find where glyph ends.
|
||||
while (end < imgw && !equal(pixels[end], spacer))
|
||||
++end;
|
||||
|
||||
if (start >= end)
|
||||
break;
|
||||
|
||||
unsigned c = glyphs[i];
|
||||
|
||||
positions[c] = start;
|
||||
widths[c] = (end - start);
|
||||
}
|
||||
|
||||
// Replace spacer color with an empty pixel
|
||||
for (unsigned int i = 0; i < imgs; ++i)
|
||||
{
|
||||
if (equal(pixels[i], spacer))
|
||||
{
|
||||
pixels[i].r = 0;
|
||||
pixels[i].g = 0;
|
||||
pixels[i].b = 0;
|
||||
pixels[i].a = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ImageRasterizer::getNumGlyphs() const
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_IMAGE_RASTERIZER_H
|
||||
#define LOVE_FONT_IMAGE_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include "filesystem/File.h"
|
||||
#include "font/Rasterizer.h"
|
||||
#include "image/ImageData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds data for a font object.
|
||||
**/
|
||||
class ImageRasterizer : public Rasterizer
|
||||
{
|
||||
private:
|
||||
// Load all the glyph positions into memory
|
||||
void load();
|
||||
|
||||
// The image data
|
||||
love::image::ImageData *imageData;
|
||||
// The glyphs in the font
|
||||
unsigned short *glyphs;
|
||||
// The length of the glyph array
|
||||
unsigned int length;
|
||||
// The positions of each glyph
|
||||
unsigned int *positions;
|
||||
// The widths of each glyph
|
||||
unsigned int *widths;
|
||||
// The spacing of each glyph
|
||||
unsigned int *spacing;
|
||||
|
||||
public:
|
||||
ImageRasterizer(love::image::ImageData *imageData, unsigned short *glyphs, int length);
|
||||
virtual ~ImageRasterizer();
|
||||
|
||||
// Implement Rasterizer
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData *getGlyphData(unsigned short glyph) const;
|
||||
virtual int getNumGlyphs() const;
|
||||
|
||||
static const unsigned int MAX_CHARS = 256;
|
||||
|
||||
}; // ImageRasterizer
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_IMAGE_RASTERIZER_H
|
||||
#define LOVE_FONT_IMAGE_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include "filesystem/File.h"
|
||||
#include "font/Rasterizer.h"
|
||||
#include "image/ImageData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds data for a font object.
|
||||
**/
|
||||
class ImageRasterizer : public Rasterizer
|
||||
{
|
||||
private:
|
||||
// Load all the glyph positions into memory
|
||||
void load();
|
||||
|
||||
// The image data
|
||||
love::image::ImageData *imageData;
|
||||
// The glyphs in the font
|
||||
unsigned short *glyphs;
|
||||
// The length of the glyph array
|
||||
unsigned int length;
|
||||
// The positions of each glyph
|
||||
unsigned int *positions;
|
||||
// The widths of each glyph
|
||||
unsigned int *widths;
|
||||
// The spacing of each glyph
|
||||
unsigned int *spacing;
|
||||
|
||||
public:
|
||||
ImageRasterizer(love::image::ImageData *imageData, unsigned short *glyphs, int length);
|
||||
virtual ~ImageRasterizer();
|
||||
|
||||
// Implement Rasterizer
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData *getGlyphData(unsigned short glyph) const;
|
||||
virtual int getNumGlyphs() const;
|
||||
|
||||
static const unsigned int MAX_CHARS = 256;
|
||||
|
||||
}; // ImageRasterizer
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_IMAGE_RASTERIZER_H
|
||||
@@ -1,54 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "Rasterizer.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
Rasterizer::~Rasterizer()
|
||||
{
|
||||
}
|
||||
|
||||
int Rasterizer::getHeight() const
|
||||
{
|
||||
return metrics.height;
|
||||
}
|
||||
|
||||
int Rasterizer::getAdvance() const
|
||||
{
|
||||
return metrics.advance;
|
||||
}
|
||||
|
||||
int Rasterizer::getAscent() const
|
||||
{
|
||||
return metrics.ascent;
|
||||
}
|
||||
|
||||
int Rasterizer::getDescent() const
|
||||
{
|
||||
return metrics.descent;
|
||||
}
|
||||
|
||||
} // font
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "Rasterizer.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
Rasterizer::~Rasterizer()
|
||||
{
|
||||
}
|
||||
|
||||
int Rasterizer::getHeight() const
|
||||
{
|
||||
return metrics.height;
|
||||
}
|
||||
|
||||
int Rasterizer::getAdvance() const
|
||||
{
|
||||
return metrics.advance;
|
||||
}
|
||||
|
||||
int Rasterizer::getAscent() const
|
||||
{
|
||||
return metrics.ascent;
|
||||
}
|
||||
|
||||
int Rasterizer::getDescent() const
|
||||
{
|
||||
return metrics.descent;
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
@@ -1,98 +1,98 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_RASTERIZER_H
|
||||
#define LOVE_FONT_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include "common/Object.h"
|
||||
#include "GlyphData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds the specific font metrics.
|
||||
**/
|
||||
struct FontMetrics
|
||||
{
|
||||
int advance;
|
||||
int ascent;
|
||||
int descent;
|
||||
int height;
|
||||
};
|
||||
|
||||
/**
|
||||
* Holds data for a font object.
|
||||
**/
|
||||
class Rasterizer : public Object
|
||||
{
|
||||
protected:
|
||||
FontMetrics metrics;
|
||||
|
||||
public:
|
||||
|
||||
virtual ~Rasterizer();
|
||||
|
||||
/**
|
||||
* Gets the max height of the glyphs.
|
||||
**/
|
||||
virtual int getHeight() const;
|
||||
|
||||
/**
|
||||
* Gets the max advance of the glyphs.
|
||||
**/
|
||||
virtual int getAdvance() const;
|
||||
|
||||
/**
|
||||
* Gets the max ascent (height above baseline) for the font.
|
||||
**/
|
||||
virtual int getAscent() const;
|
||||
|
||||
/**
|
||||
* Gets the max descent (height below baseline) for the font.
|
||||
**/
|
||||
virtual int getDescent() const;
|
||||
|
||||
/**
|
||||
* Gets the line height of the font.
|
||||
**/
|
||||
virtual int getLineHeight() const = 0;
|
||||
|
||||
/**
|
||||
* Gets a specific glyph.
|
||||
* @param glyph The (UNICODE) glyph to get data for
|
||||
**/
|
||||
virtual GlyphData *getGlyphData(unsigned short glyph) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the number of glyphs the rasterizer has data for.
|
||||
**/
|
||||
virtual int getNumGlyphs() const = 0;
|
||||
|
||||
|
||||
}; // Rasterizer
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_RASTERIZER_H
|
||||
#define LOVE_FONT_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include "common/Object.h"
|
||||
#include "GlyphData.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds the specific font metrics.
|
||||
**/
|
||||
struct FontMetrics
|
||||
{
|
||||
int advance;
|
||||
int ascent;
|
||||
int descent;
|
||||
int height;
|
||||
};
|
||||
|
||||
/**
|
||||
* Holds data for a font object.
|
||||
**/
|
||||
class Rasterizer : public Object
|
||||
{
|
||||
protected:
|
||||
FontMetrics metrics;
|
||||
|
||||
public:
|
||||
|
||||
virtual ~Rasterizer();
|
||||
|
||||
/**
|
||||
* Gets the max height of the glyphs.
|
||||
**/
|
||||
virtual int getHeight() const;
|
||||
|
||||
/**
|
||||
* Gets the max advance of the glyphs.
|
||||
**/
|
||||
virtual int getAdvance() const;
|
||||
|
||||
/**
|
||||
* Gets the max ascent (height above baseline) for the font.
|
||||
**/
|
||||
virtual int getAscent() const;
|
||||
|
||||
/**
|
||||
* Gets the max descent (height below baseline) for the font.
|
||||
**/
|
||||
virtual int getDescent() const;
|
||||
|
||||
/**
|
||||
* Gets the line height of the font.
|
||||
**/
|
||||
virtual int getLineHeight() const = 0;
|
||||
|
||||
/**
|
||||
* Gets a specific glyph.
|
||||
* @param glyph The (UNICODE) glyph to get data for
|
||||
**/
|
||||
virtual GlyphData *getGlyphData(unsigned short glyph) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the number of glyphs the rasterizer has data for.
|
||||
**/
|
||||
virtual int getNumGlyphs() const = 0;
|
||||
|
||||
|
||||
}; // Rasterizer
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_RASTERIZER_H
|
||||
@@ -1,79 +1,79 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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, std::string glyphs)
|
||||
{
|
||||
int length = glyphs.size();
|
||||
unsigned short *g = new unsigned short[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
g[i] = (unsigned char)glyphs[i];
|
||||
}
|
||||
Rasterizer *r = newRasterizer(data, g, length);
|
||||
delete [] g;
|
||||
return r;
|
||||
}
|
||||
|
||||
Rasterizer *Font::newRasterizer(love::image::ImageData *data, unsigned short *glyphs, int length)
|
||||
{
|
||||
return new ImageRasterizer(data, glyphs, length);
|
||||
}
|
||||
|
||||
GlyphData *Font::newGlyphData(Rasterizer *r, unsigned short glyph)
|
||||
{
|
||||
return r->getGlyphData(glyph);
|
||||
}
|
||||
|
||||
const char *Font::getName() const
|
||||
{
|
||||
return "love.font.freetype";
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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, std::string glyphs)
|
||||
{
|
||||
int length = glyphs.size();
|
||||
unsigned short *g = new unsigned short[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
g[i] = (unsigned char)glyphs[i];
|
||||
}
|
||||
Rasterizer *r = newRasterizer(data, g, length);
|
||||
delete [] g;
|
||||
return r;
|
||||
}
|
||||
|
||||
Rasterizer *Font::newRasterizer(love::image::ImageData *data, unsigned short *glyphs, int length)
|
||||
{
|
||||
return new ImageRasterizer(data, glyphs, length);
|
||||
}
|
||||
|
||||
GlyphData *Font::newGlyphData(Rasterizer *r, unsigned short glyph)
|
||||
{
|
||||
return r->getGlyphData(glyph);
|
||||
}
|
||||
|
||||
const char *Font::getName() const
|
||||
{
|
||||
return "love.font.freetype";
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
@@ -1,75 +1,75 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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 "font/Font.h"
|
||||
|
||||
// FreeType2
|
||||
#ifdef LOVE_MACOSX
|
||||
#include <freetype/ft2build.h>
|
||||
#else
|
||||
#include <ft2build.h>
|
||||
#endif
|
||||
#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 love::font::Font
|
||||
{
|
||||
public:
|
||||
|
||||
Font();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
virtual ~Font();
|
||||
|
||||
// Implements Font
|
||||
Rasterizer *newRasterizer(Data *data, int size);
|
||||
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);
|
||||
|
||||
// Implement Module
|
||||
const char *getName() const;
|
||||
|
||||
private:
|
||||
|
||||
// FreeType library
|
||||
FT_Library library;
|
||||
}; // Font
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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 "font/Font.h"
|
||||
|
||||
// FreeType2
|
||||
#ifdef LOVE_MACOSX
|
||||
#include <freetype/ft2build.h>
|
||||
#else
|
||||
#include <ft2build.h>
|
||||
#endif
|
||||
#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 love::font::Font
|
||||
{
|
||||
public:
|
||||
|
||||
Font();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
virtual ~Font();
|
||||
|
||||
// Implements Font
|
||||
Rasterizer *newRasterizer(Data *data, int size);
|
||||
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);
|
||||
|
||||
// Implement Module
|
||||
const char *getName() const;
|
||||
|
||||
private:
|
||||
|
||||
// FreeType library
|
||||
FT_Library library;
|
||||
}; // Font
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREETYPE_FONT_H
|
||||
@@ -1,123 +1,123 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "TrueTypeRasterizer.h"
|
||||
|
||||
#include "common/Exception.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
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 */
|
||||
0, /* face_index */
|
||||
&face))
|
||||
throw love::Exception("TrueTypeFont Loading error: FT_New_Face failed (there is probably a problem with your font file)\n");
|
||||
|
||||
FT_Set_Pixel_Sizes(face, size, size);
|
||||
|
||||
// Set global metrics
|
||||
FT_Size_Metrics s = face->size->metrics;
|
||||
metrics.advance = s.max_advance >> 6;
|
||||
metrics.ascent = s.ascender >> 6;
|
||||
metrics.descent = s.descender >> 6;
|
||||
metrics.height = s.height >> 6;
|
||||
}
|
||||
|
||||
TrueTypeRasterizer::~TrueTypeRasterizer()
|
||||
{
|
||||
FT_Done_Face(face);
|
||||
data->release();
|
||||
}
|
||||
|
||||
int TrueTypeRasterizer::getLineHeight() const
|
||||
{
|
||||
return (int)(getHeight() * 1.25);
|
||||
}
|
||||
|
||||
GlyphData *TrueTypeRasterizer::getGlyphData(unsigned short 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 vm->error: FT_Load_Glyph failed\n");
|
||||
|
||||
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
|
||||
|
||||
// Get metrics
|
||||
glyphMetrics.bearingX = face->glyph->metrics.horiBearingX >> 6;
|
||||
glyphMetrics.bearingY = face->glyph->metrics.horiBearingY >> 6;
|
||||
glyphMetrics.height = bitmap.rows;
|
||||
glyphMetrics.width = bitmap.width;
|
||||
glyphMetrics.advance = face->glyph->metrics.horiAdvance >> 6;
|
||||
|
||||
GlyphData *glyphData = new GlyphData(glyph, glyphMetrics, GlyphData::FORMAT_LUMINANCE_ALPHA);
|
||||
|
||||
{
|
||||
int size = bitmap.rows*bitmap.width;
|
||||
unsigned char *dst = (unsigned char *)glyphData->getData();
|
||||
|
||||
// Note that bitmap.buffer contains only luminosity. We copy that single value to
|
||||
// our luminosity-alpha format.
|
||||
for (int i = 0; i<size; i++)
|
||||
{
|
||||
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);
|
||||
|
||||
// Return data
|
||||
return glyphData;
|
||||
}
|
||||
|
||||
int TrueTypeRasterizer::getNumGlyphs() const
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "TrueTypeRasterizer.h"
|
||||
|
||||
#include "common/Exception.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
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 */
|
||||
0, /* face_index */
|
||||
&face))
|
||||
throw love::Exception("TrueTypeFont Loading error: FT_New_Face failed (there is probably a problem with your font file)\n");
|
||||
|
||||
FT_Set_Pixel_Sizes(face, size, size);
|
||||
|
||||
// Set global metrics
|
||||
FT_Size_Metrics s = face->size->metrics;
|
||||
metrics.advance = s.max_advance >> 6;
|
||||
metrics.ascent = s.ascender >> 6;
|
||||
metrics.descent = s.descender >> 6;
|
||||
metrics.height = s.height >> 6;
|
||||
}
|
||||
|
||||
TrueTypeRasterizer::~TrueTypeRasterizer()
|
||||
{
|
||||
FT_Done_Face(face);
|
||||
data->release();
|
||||
}
|
||||
|
||||
int TrueTypeRasterizer::getLineHeight() const
|
||||
{
|
||||
return (int)(getHeight() * 1.25);
|
||||
}
|
||||
|
||||
GlyphData *TrueTypeRasterizer::getGlyphData(unsigned short 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 vm->error: FT_Load_Glyph failed\n");
|
||||
|
||||
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
|
||||
|
||||
// Get metrics
|
||||
glyphMetrics.bearingX = face->glyph->metrics.horiBearingX >> 6;
|
||||
glyphMetrics.bearingY = face->glyph->metrics.horiBearingY >> 6;
|
||||
glyphMetrics.height = bitmap.rows;
|
||||
glyphMetrics.width = bitmap.width;
|
||||
glyphMetrics.advance = face->glyph->metrics.horiAdvance >> 6;
|
||||
|
||||
GlyphData *glyphData = new GlyphData(glyph, glyphMetrics, GlyphData::FORMAT_LUMINANCE_ALPHA);
|
||||
|
||||
{
|
||||
int size = bitmap.rows*bitmap.width;
|
||||
unsigned char *dst = (unsigned char *)glyphData->getData();
|
||||
|
||||
// Note that bitmap.buffer contains only luminosity. We copy that single value to
|
||||
// our luminosity-alpha format.
|
||||
for (int i = 0; i<size; i++)
|
||||
{
|
||||
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);
|
||||
|
||||
// Return data
|
||||
return glyphData;
|
||||
}
|
||||
|
||||
int TrueTypeRasterizer::getNumGlyphs() const
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
@@ -1,69 +1,69 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_TRUE_TYPE_RASTERIZER_H
|
||||
#define LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include "filesystem/File.h"
|
||||
#include "font/Rasterizer.h"
|
||||
|
||||
// TrueType2
|
||||
#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
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds data for a font object.
|
||||
**/
|
||||
class TrueTypeRasterizer : public Rasterizer
|
||||
{
|
||||
public:
|
||||
TrueTypeRasterizer(FT_Library library, Data *data, int size);
|
||||
virtual ~TrueTypeRasterizer();
|
||||
|
||||
// Implement Rasterizer
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData *getGlyphData(unsigned short glyph) const;
|
||||
virtual int getNumGlyphs() const;
|
||||
|
||||
private:
|
||||
|
||||
// TrueType face
|
||||
FT_Face face;
|
||||
|
||||
// File data
|
||||
Data *data;
|
||||
}; // FreetypeRasterizer
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_TRUE_TYPE_RASTERIZER_H
|
||||
#define LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
|
||||
// LOVE
|
||||
#include "filesystem/File.h"
|
||||
#include "font/Rasterizer.h"
|
||||
|
||||
// TrueType2
|
||||
#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
|
||||
{
|
||||
|
||||
/**
|
||||
* Holds data for a font object.
|
||||
**/
|
||||
class TrueTypeRasterizer : public Rasterizer
|
||||
{
|
||||
public:
|
||||
TrueTypeRasterizer(FT_Library library, Data *data, int size);
|
||||
virtual ~TrueTypeRasterizer();
|
||||
|
||||
// Implement Rasterizer
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData *getGlyphData(unsigned short glyph) const;
|
||||
virtual int getNumGlyphs() const;
|
||||
|
||||
private:
|
||||
|
||||
// TrueType face
|
||||
FT_Face face;
|
||||
|
||||
// File data
|
||||
Data *data;
|
||||
}; // FreetypeRasterizer
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
@@ -1,113 +1,113 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_Font.h"
|
||||
|
||||
#include "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 w_newRasterizer(lua_State *L)
|
||||
{
|
||||
Rasterizer *t = NULL;
|
||||
if (luax_istype(L, 1, IMAGE_IMAGE_DATA_T))
|
||||
{
|
||||
love::image::ImageData *d = luax_checktype<love::image::ImageData>(L, 1, "ImageData", IMAGE_IMAGE_DATA_T);
|
||||
const char *g = luaL_checkstring(L, 2);
|
||||
std::string glyphs(g);
|
||||
t = instance->newRasterizer(d, glyphs);
|
||||
}
|
||||
else if (luax_istype(L, 1, DATA_T))
|
||||
{
|
||||
Data *d = luax_checkdata(L, 1);
|
||||
int size = luaL_checkint(L, 2);
|
||||
t = instance->newRasterizer(d, size);
|
||||
}
|
||||
|
||||
luax_newtype(L, "Rasterizer", FONT_RASTERIZER_T, t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_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", FONT_GLYPH_DATA_T, t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "newRasterizer", w_newRasterizer },
|
||||
{ "newGlyphData", w_newGlyphData },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] =
|
||||
{
|
||||
luaopen_glyphdata,
|
||||
luaopen_rasterizer,
|
||||
0
|
||||
};
|
||||
|
||||
extern "C" int luaopen_love_font(lua_State *L)
|
||||
{
|
||||
if (instance == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = new Font();
|
||||
}
|
||||
catch(Exception &e)
|
||||
{
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "font";
|
||||
w.flags = MODULE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
return luax_register_module(L, w);
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_Font.h"
|
||||
|
||||
#include "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 w_newRasterizer(lua_State *L)
|
||||
{
|
||||
Rasterizer *t = NULL;
|
||||
if (luax_istype(L, 1, IMAGE_IMAGE_DATA_T))
|
||||
{
|
||||
love::image::ImageData *d = luax_checktype<love::image::ImageData>(L, 1, "ImageData", IMAGE_IMAGE_DATA_T);
|
||||
const char *g = luaL_checkstring(L, 2);
|
||||
std::string glyphs(g);
|
||||
t = instance->newRasterizer(d, glyphs);
|
||||
}
|
||||
else if (luax_istype(L, 1, DATA_T))
|
||||
{
|
||||
Data *d = luax_checkdata(L, 1);
|
||||
int size = luaL_checkint(L, 2);
|
||||
t = instance->newRasterizer(d, size);
|
||||
}
|
||||
|
||||
luax_newtype(L, "Rasterizer", FONT_RASTERIZER_T, t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_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", FONT_GLYPH_DATA_T, t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "newRasterizer", w_newRasterizer },
|
||||
{ "newGlyphData", w_newGlyphData },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] =
|
||||
{
|
||||
luaopen_glyphdata,
|
||||
luaopen_rasterizer,
|
||||
0
|
||||
};
|
||||
|
||||
extern "C" int luaopen_love_font(lua_State *L)
|
||||
{
|
||||
if (instance == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = new Font();
|
||||
}
|
||||
catch(Exception &e)
|
||||
{
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "font";
|
||||
w.flags = MODULE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
return luax_register_module(L, w);
|
||||
}
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_WRAP_FONT_H
|
||||
#define LOVE_FONT_FREETYPE_WRAP_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include "common/config.h"
|
||||
#include "common/runtime.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
namespace freetype
|
||||
{
|
||||
|
||||
int w_newRasterizer(lua_State *L);
|
||||
int w_newGlyphData(lua_State *L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_font(lua_State *L);
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREETYPE_WRAP_FONT_H
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_WRAP_FONT_H
|
||||
#define LOVE_FONT_FREETYPE_WRAP_FONT_H
|
||||
|
||||
// LOVE
|
||||
#include "common/config.h"
|
||||
#include "common/runtime.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace font
|
||||
{
|
||||
namespace freetype
|
||||
{
|
||||
|
||||
int w_newRasterizer(lua_State *L);
|
||||
int w_newGlyphData(lua_State *L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_font(lua_State *L);
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREETYPE_WRAP_FONT_H
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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", FONT_GLYPH_DATA_T);
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
extern "C" int luaopen_glyphdata(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, "GlyphData", functions);
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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", FONT_GLYPH_DATA_T);
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
extern "C" int luaopen_glyphdata(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, "GlyphData", functions);
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_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);
|
||||
extern "C" int luaopen_glyphdata(lua_State *L);
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_WRAP_GLYPH_DATA_H
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_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);
|
||||
extern "C" int luaopen_glyphdata(lua_State *L);
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_WRAP_GLYPH_DATA_H
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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", FONT_RASTERIZER_T);
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
extern "C" int luaopen_rasterizer(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, "Rasterizer", functions);
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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", FONT_RASTERIZER_T);
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
extern "C" int luaopen_rasterizer(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, "Rasterizer", functions);
|
||||
}
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_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);
|
||||
extern "C" int luaopen_rasterizer(lua_State *L);
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_WRAP_RASTERIZER_H
|
||||
/**
|
||||
* Copyright (c) 2006-2012 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_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);
|
||||
extern "C" int luaopen_rasterizer(lua_State *L);
|
||||
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_WRAP_RASTERIZER_H
|
||||
|
||||
Reference in New Issue
Block a user