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
This commit is contained in:
parent
4d2e5b18e2
commit
d950c9387a
@ -631,7 +631,7 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, f
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute the glyph's advance offset
|
// Compute the glyph's advance offset
|
||||||
glyph.advance = std::round(static_cast<float>(bitmapGlyph->root.advance.x) / static_cast<float>(1 << 16));
|
glyph.advance = static_cast<float>(bitmapGlyph->root.advance.x >> 16);
|
||||||
if (bold)
|
if (bold)
|
||||||
glyph.advance += static_cast<float>(weight) / static_cast<float>(1 << 6);
|
glyph.advance += static_cast<float>(weight) / static_cast<float>(1 << 6);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user