Added an optional spacing argument to love.graphics.newImageFont, allowing additional spacing (positive or negative) to be applied to all glyphs rendered using that font.

This commit is contained in:
Alex Szpakowski
2015-03-11 18:28:22 -03:00
parent b1f4beac56
commit a119e6a862
6 changed files with 28 additions and 19 deletions
+10 -7
View File
@@ -39,7 +39,7 @@ namespace font
class ImageRasterizer : public Rasterizer
{
public:
ImageRasterizer(love::image::ImageData *imageData, uint32 *glyphs, int numglyphs);
ImageRasterizer(love::image::ImageData *imageData, uint32 *glyphs, int numglyphs, int extraspacing);
virtual ~ImageRasterizer();
// Implement Rasterizer
@@ -49,6 +49,14 @@ public:
virtual bool hasGlyph(uint32 glyph) const;
private:
// Information about a glyph in the ImageData
struct ImageGlyphData
{
int x;
int width;
};
// Load all the glyph positions into memory
void load();
@@ -61,12 +69,7 @@ private:
// Number of glyphs in the font
int numglyphs;
// Information about a glyph in the ImageData
struct ImageGlyphData
{
int x;
int width;
};
int extraSpacing;
std::map<uint32, ImageGlyphData> imageGlyphs;