mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Added basic kerning support for TrueType and BMFont fonts (resolves issue #1055.)
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include "image/ImageData.h"
|
||||
|
||||
// C++
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace love
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
GlyphData *getGlyphData(uint32 glyph) const override;
|
||||
int getGlyphCount() const override;
|
||||
bool hasGlyph(uint32 glyph) const override;
|
||||
float getKerning(uint32 leftglyph, uint32 rightglyph) const;
|
||||
|
||||
static bool accepts(love::filesystem::FileData *fontdef);
|
||||
|
||||
@@ -68,10 +69,13 @@ private:
|
||||
std::string fontFolder;
|
||||
|
||||
// Image pages, indexed by their page id.
|
||||
std::map<int, StrongRef<image::ImageData>> images;
|
||||
std::unordered_map<int, StrongRef<image::ImageData>> images;
|
||||
|
||||
// Glyph characters, indexed by their glyph id.
|
||||
std::map<uint32, BMFontCharacter> characters;
|
||||
std::unordered_map<uint32, BMFontCharacter> characters;
|
||||
|
||||
// Kerning information, indexed by two (packed) characters.
|
||||
std::unordered_map<uint64, int> kerning;
|
||||
|
||||
int fontSize;
|
||||
bool unicode;
|
||||
|
||||
Reference in New Issue
Block a user