mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Font glyphs created from ImageFonts no longer treat separator pixels as spacing (resolves issue #190.)
--HG-- branch : minor
This commit is contained in:
@@ -60,7 +60,7 @@ GlyphData *ImageRasterizer::getGlyphData(uint32 glyph) const
|
|||||||
if (it != imageGlyphs.end())
|
if (it != imageGlyphs.end())
|
||||||
{
|
{
|
||||||
gm.width = it->second.width;
|
gm.width = it->second.width;
|
||||||
gm.advance = it->second.width + it->second.spacing;
|
gm.advance = it->second.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
gm.height = metrics.height;
|
gm.height = metrics.height;
|
||||||
@@ -118,10 +118,6 @@ void ImageRasterizer::load()
|
|||||||
while (start < imgw && equal(pixels[start], spacer))
|
while (start < imgw && equal(pixels[start], spacer))
|
||||||
++start;
|
++start;
|
||||||
|
|
||||||
// set previous glyph's spacing
|
|
||||||
if (i > 0 && imageGlyphs.size() > 0)
|
|
||||||
imageGlyphs[glyphs[i - 1]].spacing = (start > end) ? (start - end) : 0;
|
|
||||||
|
|
||||||
end = start;
|
end = start;
|
||||||
|
|
||||||
// Find where glyph ends.
|
// Find where glyph ends.
|
||||||
@@ -137,16 +133,6 @@ void ImageRasterizer::load()
|
|||||||
|
|
||||||
imageGlyphs[glyphs[i]] = imageGlyph;
|
imageGlyphs[glyphs[i]] = imageGlyph;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find spacing of last glyph
|
|
||||||
if (numglyphs > 0)
|
|
||||||
{
|
|
||||||
start = end;
|
|
||||||
while (start < imgw && equal(pixels[start], spacer))
|
|
||||||
++start;
|
|
||||||
|
|
||||||
imageGlyphs[glyphs[numglyphs - 1]].spacing = (start > end) ? (start - end) : 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImageRasterizer::getGlyphCount() const
|
int ImageRasterizer::getGlyphCount() const
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ private:
|
|||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int width;
|
int width;
|
||||||
int spacing;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::map<uint32, ImageGlyphData> imageGlyphs;
|
std::map<uint32, ImageGlyphData> imageGlyphs;
|
||||||
|
|||||||
Reference in New Issue
Block a user