From 1f8b022d177a76133526799e69275650f8b31d1d Mon Sep 17 00:00:00 2001 From: Zachariah Brown Date: Thu, 9 Oct 2014 09:35:37 -0400 Subject: [PATCH] Changed the font metrics to return floats instead of ints --- include/SFML/Graphics/Font.h | 4 ++-- include/SFML/Graphics/Glyph.h | 6 +++--- src/SFML/Graphics/Font.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/SFML/Graphics/Font.h b/include/SFML/Graphics/Font.h index f8f3f25..6328e20 100644 --- a/include/SFML/Graphics/Font.h +++ b/include/SFML/Graphics/Font.h @@ -108,7 +108,7 @@ CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, uns /// \return Kerning offset, in pixels /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize); +CSFML_GRAPHICS_API float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize); //////////////////////////////////////////////////////////// /// \brief Get the line spacing value @@ -119,7 +119,7 @@ CSFML_GRAPHICS_API int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 /// \return Line spacing, in pixels /// //////////////////////////////////////////////////////////// -CSFML_GRAPHICS_API int sfFont_getLineSpacing(sfFont* font, unsigned int characterSize); +CSFML_GRAPHICS_API float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize); //////////////////////////////////////////////////////////// /// \brief Get the texture containing the glyphs of a given size in a font diff --git a/include/SFML/Graphics/Glyph.h b/include/SFML/Graphics/Glyph.h index a9b0ef7..6bf08c5 100644 --- a/include/SFML/Graphics/Glyph.h +++ b/include/SFML/Graphics/Glyph.h @@ -37,9 +37,9 @@ //////////////////////////////////////////////////////////// typedef struct { - int advance; ///< Offset to move horizontically to the next character - sfIntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline - sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image + float advance; ///< Offset to move horizontically to the next character + sfFloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline + sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image } sfGlyph; diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 29c2c82..1a95c36 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -129,7 +129,7 @@ sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int character //////////////////////////////////////////////////////////// /// Get the kerning value corresponding to a given pair of characters in a font //////////////////////////////////////////////////////////// -int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize) +float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize) { CSFML_CALL_RETURN(font, getKerning(first, second, characterSize), 0); } @@ -138,7 +138,7 @@ int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned in //////////////////////////////////////////////////////////// /// Get the line spacing value //////////////////////////////////////////////////////////// -int sfFont_getLineSpacing(sfFont* font, unsigned int characterSize) +float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize) { CSFML_CALL_RETURN(font, getLineSpacing(characterSize), 0); }