mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Improve truetype font text positioning with fractional glyph advances and DPI-scaled coordinates.
Disallow Font:setFallbacks for fonts that have different DPI scales. It's still too easy to render text at a non-integer pixel when fractional DPI scales are used, so maybe a more thorough redesign would be useful. Fixes #2318. Fixes #2168.
This commit is contained in:
@@ -608,12 +608,12 @@ void Font::printf(graphics::Graphics *gfx, const std::vector<love::font::Colored
|
||||
printv(gfx, m, drawcommands, vertices);
|
||||
}
|
||||
|
||||
int Font::getWidth(const std::string &str)
|
||||
float Font::getWidth(const std::string &str)
|
||||
{
|
||||
return shaper->getWidth(str);
|
||||
}
|
||||
|
||||
int Font::getWidth(uint32 glyph)
|
||||
float Font::getWidth(uint32 glyph)
|
||||
{
|
||||
return shaper->getGlyphAdvance(glyph);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user