Add Font:getKerning.

Also add a variant of Font:getWidth which accepts a codepoint number.
Fixes #1403
This commit is contained in:
Alex Szpakowski
2021-04-05 11:22:54 -03:00
parent b5ef8a8c2c
commit 7b6978f052
4 changed files with 62 additions and 10 deletions
+5 -5
View File
@@ -128,11 +128,9 @@ public:
int getWidth(const std::string &str);
/**
* Returns the width of the passed character.
*
* @param character A character.
* Returns the width of the passed glyph.
**/
int getWidth(char character);
int getWidth(uint32 glyph);
/**
* Returns the maximal width of a wrapped string
@@ -169,6 +167,9 @@ public:
bool hasGlyph(uint32 glyph) const;
bool hasGlyphs(const std::string &text) const;
float getKerning(uint32 leftglyph, uint32 rightglyph);
float getKerning(const std::string &leftchar, const std::string &rightchar);
void setFallbacks(const std::vector<Font *> &fallbacks);
float getDPIScale() const;
@@ -206,7 +207,6 @@ private:
love::font::GlyphData *getRasterizerGlyphData(uint32 glyph, float &dpiscale);
const Glyph &addGlyph(uint32 glyph);
const Glyph &findGlyph(uint32 glyph);
float getKerning(uint32 leftglyph, uint32 rightglyph);
void printv(Graphics *gfx, const Matrix4 &t, const std::vector<DrawCommand> &drawcommands, const std::vector<GlyphVertex> &vertices);
std::vector<StrongRef<love::font::Rasterizer>> rasterizers;