diff --git a/src/modules/font/Font.h b/src/modules/font/Font.h index 5529015b9..179805995 100644 --- a/src/modules/font/Font.h +++ b/src/modules/font/Font.h @@ -41,8 +41,8 @@ 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; + virtual Rasterizer *newRasterizer(love::image::ImageData *data, unsigned int *glyphs, int length) = 0; + virtual GlyphData *newGlyphData(Rasterizer *r, unsigned int glyph) = 0; // Implement Module virtual const char *getName() const = 0; diff --git a/src/modules/font/GlyphData.cpp b/src/modules/font/GlyphData.cpp index 8bd690108..b67d1babe 100644 --- a/src/modules/font/GlyphData.cpp +++ b/src/modules/font/GlyphData.cpp @@ -27,7 +27,7 @@ namespace love namespace font { -GlyphData::GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics, GlyphData::Format f) +GlyphData::GlyphData(unsigned int glyph, GlyphMetrics glyphMetrics, GlyphData::Format f) : glyph(glyph) , metrics(glyphMetrics) , data(0) diff --git a/src/modules/font/GlyphData.h b/src/modules/font/GlyphData.h index 8cbb315eb..e148a981a 100644 --- a/src/modules/font/GlyphData.h +++ b/src/modules/font/GlyphData.h @@ -56,7 +56,7 @@ public: FORMAT_RGBA }; - GlyphData(unsigned short glyph, GlyphMetrics glyphMetrics, Format f); + GlyphData(unsigned int glyph, GlyphMetrics glyphMetrics, Format f); virtual ~GlyphData(); // Implements Data. @@ -115,7 +115,7 @@ public: private: // The glyph itself - unsigned short glyph; + unsigned int glyph; // Glyph metrics GlyphMetrics metrics; diff --git a/src/modules/font/ImageRasterizer.cpp b/src/modules/font/ImageRasterizer.cpp index 21f45539b..da97c27df 100644 --- a/src/modules/font/ImageRasterizer.cpp +++ b/src/modules/font/ImageRasterizer.cpp @@ -34,7 +34,7 @@ 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) +ImageRasterizer::ImageRasterizer(love::image::ImageData *data, unsigned int *glyphs, int length) : imageData(data) , glyphs(glyphs) , length(length) @@ -62,7 +62,7 @@ int ImageRasterizer::getLineHeight() const return getHeight(); } -GlyphData *ImageRasterizer::getGlyphData(unsigned short glyph) const +GlyphData *ImageRasterizer::getGlyphData(unsigned int glyph) const { GlyphMetrics gm; gm.height = metrics.height; diff --git a/src/modules/font/ImageRasterizer.h b/src/modules/font/ImageRasterizer.h index da649cfb5..beb6b338c 100644 --- a/src/modules/font/ImageRasterizer.h +++ b/src/modules/font/ImageRasterizer.h @@ -43,7 +43,7 @@ private: // The image data love::image::ImageData *imageData; // The glyphs in the font - unsigned short *glyphs; + unsigned int *glyphs; // The length of the glyph array unsigned int length; // The positions of each glyph @@ -54,12 +54,12 @@ private: unsigned int *spacing; public: - ImageRasterizer(love::image::ImageData *imageData, unsigned short *glyphs, int length); + ImageRasterizer(love::image::ImageData *imageData, unsigned int *glyphs, int length); virtual ~ImageRasterizer(); // Implement Rasterizer virtual int getLineHeight() const; - virtual GlyphData *getGlyphData(unsigned short glyph) const; + virtual GlyphData *getGlyphData(unsigned int glyph) const; virtual int getNumGlyphs() const; static const unsigned int MAX_CHARS = 256; diff --git a/src/modules/font/Rasterizer.h b/src/modules/font/Rasterizer.h index 46e27143b..f625dae6c 100644 --- a/src/modules/font/Rasterizer.h +++ b/src/modules/font/Rasterizer.h @@ -82,7 +82,7 @@ public: * Gets a specific glyph. * @param glyph The (UNICODE) glyph to get data for **/ - virtual GlyphData *getGlyphData(unsigned short glyph) const = 0; + virtual GlyphData *getGlyphData(unsigned int glyph) const = 0; /** * Gets the number of glyphs the rasterizer has data for. diff --git a/src/modules/font/freetype/Font.cpp b/src/modules/font/freetype/Font.cpp index d4a893212..b0aaf894e 100644 --- a/src/modules/font/freetype/Font.cpp +++ b/src/modules/font/freetype/Font.cpp @@ -49,7 +49,7 @@ Rasterizer *Font::newRasterizer(Data *data, int size) Rasterizer *Font::newRasterizer(love::image::ImageData *data, std::string glyphs) { int length = glyphs.size(); - unsigned short *g = new unsigned short[length]; + unsigned int *g = new unsigned int[length]; for (int i = 0; i < length; i++) { g[i] = (unsigned char)glyphs[i]; @@ -59,12 +59,12 @@ Rasterizer *Font::newRasterizer(love::image::ImageData *data, std::string glyphs return r; } -Rasterizer *Font::newRasterizer(love::image::ImageData *data, unsigned short *glyphs, int length) +Rasterizer *Font::newRasterizer(love::image::ImageData *data, unsigned int *glyphs, int length) { return new ImageRasterizer(data, glyphs, length); } -GlyphData *Font::newGlyphData(Rasterizer *r, unsigned short glyph) +GlyphData *Font::newGlyphData(Rasterizer *r, unsigned int glyph) { return r->getGlyphData(glyph); } diff --git a/src/modules/font/freetype/Font.h b/src/modules/font/freetype/Font.h index 4bdc67ea9..d87ca641d 100644 --- a/src/modules/font/freetype/Font.h +++ b/src/modules/font/freetype/Font.h @@ -56,8 +56,8 @@ public: // 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); + Rasterizer *newRasterizer(love::image::ImageData *data, unsigned int *glyphs, int length); + GlyphData *newGlyphData(Rasterizer *r, unsigned int glyph); // Implement Module const char *getName() const; diff --git a/src/modules/font/freetype/TrueTypeRasterizer.cpp b/src/modules/font/freetype/TrueTypeRasterizer.cpp index f302b2de5..49b26a02b 100644 --- a/src/modules/font/freetype/TrueTypeRasterizer.cpp +++ b/src/modules/font/freetype/TrueTypeRasterizer.cpp @@ -68,7 +68,7 @@ int TrueTypeRasterizer::getLineHeight() const return (int)(getHeight() * 1.25); } -GlyphData *TrueTypeRasterizer::getGlyphData(unsigned short glyph) const +GlyphData *TrueTypeRasterizer::getGlyphData(unsigned int glyph) const { love::font::GlyphMetrics glyphMetrics; FT_Glyph ftglyph; diff --git a/src/modules/font/freetype/TrueTypeRasterizer.h b/src/modules/font/freetype/TrueTypeRasterizer.h index 01e41a80a..3a0ecce5b 100644 --- a/src/modules/font/freetype/TrueTypeRasterizer.h +++ b/src/modules/font/freetype/TrueTypeRasterizer.h @@ -50,7 +50,7 @@ public: // Implement Rasterizer virtual int getLineHeight() const; - virtual GlyphData *getGlyphData(unsigned short glyph) const; + virtual GlyphData *getGlyphData(unsigned int glyph) const; virtual int getNumGlyphs() const; private: diff --git a/src/modules/font/freetype/wrap_Font.cpp b/src/modules/font/freetype/wrap_Font.cpp index 019930426..c877faf19 100644 --- a/src/modules/font/freetype/wrap_Font.cpp +++ b/src/modules/font/freetype/wrap_Font.cpp @@ -67,7 +67,7 @@ int w_newRasterizer(lua_State *L) int w_newGlyphData(lua_State *L) { Rasterizer *r = luax_checkrasterizer(L, 1); - unsigned short g = (unsigned short)luaL_checkint(L, 2); + unsigned int g = (unsigned int)luaL_checknumber(L, 2); GlyphData *t = instance->newGlyphData(r, g); luax_newtype(L, "GlyphData", FONT_GLYPH_DATA_T, t); diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index a7af1eef2..ce4d0231b 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -160,7 +160,7 @@ void Font::createTexture() setMipmapSharpness(mipmapsharpness); } -Font::Glyph *Font::addGlyph(const int glyph) +Font::Glyph *Font::addGlyph(unsigned int glyph) { love::font::GlyphData *gd = rasterizer->getGlyphData(glyph); int w = gd->getWidth(); @@ -233,7 +233,7 @@ Font::Glyph *Font::addGlyph(const int glyph) return g; } -Font::Glyph *Font::findGlyph(const int glyph) +Font::Glyph *Font::findGlyph(unsigned int glyph) { Glyph *g = glyphs[glyph]; if (!g) @@ -273,7 +273,7 @@ void Font::print(const std::string &text, float x, float y, float letter_spacing while (i != end) { - int g = *i++; + unsigned int g = *i++; if (g == '\n') { @@ -380,7 +380,7 @@ int Font::getWidth(const std::string &str) utf8::iterator end(line.end(), line.begin(), line.end()); while (i != end) { - int c = *i++; + unsigned int c = *i++; g = findGlyph(c); width += static_cast(g->spacing * mSpacing); } @@ -402,7 +402,7 @@ int Font::getWidth(const char *str) return this->getWidth(std::string(str)); } -int Font::getWidth(const char character) +int Font::getWidth(unsigned int character) { Glyph *g = findGlyph(character); return g->spacing; @@ -574,7 +574,7 @@ bool Font::loadVolatile() void Font::unloadVolatile() { // nuke everything from orbit - std::map::iterator it = glyphs.begin(); + std::map::iterator it = glyphs.begin(); Glyph *g; while (it != glyphs.end()) { diff --git a/src/modules/graphics/opengl/Font.h b/src/modules/graphics/opengl/Font.h index c29372346..d50a2c3d8 100644 --- a/src/modules/graphics/opengl/Font.h +++ b/src/modules/graphics/opengl/Font.h @@ -78,17 +78,17 @@ public: /** * Returns the width of the passed string. * - * @param line A line of text. + * @param str A string of text. **/ - int getWidth(const std::string &line); - int getWidth(const char *line); + int getWidth(const std::string &str); + int getWidth(const char *str); /** * Returns the width of the passed character. * * @param character A character. **/ - int getWidth(const char character); + int getWidth(unsigned int character); /** * Returns the maximal width of a wrapped string @@ -191,7 +191,7 @@ private: int texture_height; std::vector textures; // vector of packed textures - std::map glyphs; // maps glyphs to quad information + std::map glyphs; // maps glyphs to quad information FontType type; Image::Filter filter; @@ -214,8 +214,8 @@ private: bool initializeTexture(GLint format); void createTexture(); - Glyph *addGlyph(const int glyph); - Glyph *findGlyph (const int glyph); + Glyph *addGlyph(unsigned int glyph); + Glyph *findGlyph(unsigned int glyph); }; // Font } // opengl