From d950c9387a94087f478434fb42b95c5a9c746fb2 Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Mon, 11 Oct 2021 08:11:27 +0100 Subject: [PATCH] Simplify glyph advance calculation Since auto-hinting is enabled, the advance will always be an integer number of pixels. The actual fractional advance is handled by bearings. https://github.com/SFML/SFML/pull/1827#issuecomment-939531582 --- src/SFML/Graphics/Font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 0b285640..666266ad 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -631,7 +631,7 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, f } // Compute the glyph's advance offset - glyph.advance = std::round(static_cast(bitmapGlyph->root.advance.x) / static_cast(1 << 16)); + glyph.advance = static_cast(bitmapGlyph->root.advance.x >> 16); if (bold) glyph.advance += static_cast(weight) / static_cast(1 << 6);