Fixed font glyphs always being 2 pixels larger than they are supposed to be in each dimension, fixed wrong underline offset with some fonts, offset underline and strike through by half of their thickness so their center is positioned correctly, changed glyph and font metrics to use floats instead of ints to support scaling better.

This commit is contained in:
binary1248 2014-08-28 03:39:26 +02:00
parent c36ea074d8
commit b27cbd5036
4 changed files with 58 additions and 56 deletions

View file

@ -181,7 +181,7 @@ public :
/// \return Kerning value for \a first and \a second, in pixels
///
////////////////////////////////////////////////////////////
int getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
float getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Get the line spacing
@ -194,7 +194,7 @@ public :
/// \return Line spacing, in pixels
///
////////////////////////////////////////////////////////////
int getLineSpacing(unsigned int characterSize) const;
float getLineSpacing(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Get the position of the underline
@ -209,7 +209,7 @@ public :
/// \see getUnderlineThickness
///
////////////////////////////////////////////////////////////
int getUnderlinePosition(unsigned int characterSize) const;
float getUnderlinePosition(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Get the thickness of the underline
@ -223,7 +223,7 @@ public :
/// \see getUnderlinePosition
///
////////////////////////////////////////////////////////////
int getUnderlineThickness(unsigned int characterSize) const;
float getUnderlineThickness(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Retrieve the texture containing the loaded glyphs of a certain size

View file

@ -51,9 +51,9 @@ public :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
int advance; ///< Offset to move horizontically to the next character
IntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture
float advance; ///< Offset to move horizontically to the next character
FloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture
};
} // namespace sf