From 6667deca6fde40eab0dfa33202242793101786b1 Mon Sep 17 00:00:00 2001 From: Zachariah Brown Date: Mon, 23 Feb 2015 20:59:55 -0500 Subject: [PATCH 1/2] Removed excessive documentation to remain more consistant with the rest of the code base --- src/SFML/Graphics/Font.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 320c269..6f003e9 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -31,8 +31,6 @@ #include -//////////////////////////////////////////////////////////// -/// Create a new font from a file //////////////////////////////////////////////////////////// sfFont* sfFont_createFromFile(const char* filename) { @@ -47,8 +45,6 @@ sfFont* sfFont_createFromFile(const char* filename) } -//////////////////////////////////////////////////////////// -/// Create a new font from a file in memory //////////////////////////////////////////////////////////// sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes) { @@ -63,8 +59,6 @@ sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes) } -//////////////////////////////////////////////////////////// -/// Create a new font from a custom stream //////////////////////////////////////////////////////////// sfFont* sfFont_createFromStream(sfInputStream* stream) { @@ -82,8 +76,6 @@ sfFont* sfFont_createFromStream(sfInputStream* stream) } -//////////////////////////////////////////////////////////// -/// Copy an existing font //////////////////////////////////////////////////////////// sfFont* sfFont_copy(const sfFont* font) { @@ -93,8 +85,6 @@ sfFont* sfFont_copy(const sfFont* font) } -//////////////////////////////////////////////////////////// -/// Destroy an existing font //////////////////////////////////////////////////////////// void sfFont_destroy(sfFont* font) { @@ -102,8 +92,6 @@ void sfFont_destroy(sfFont* font) } -//////////////////////////////////////////////////////////// -/// Get a glyph in a font //////////////////////////////////////////////////////////// sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold) { @@ -126,8 +114,6 @@ sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int character } -//////////////////////////////////////////////////////////// -/// Get the kerning value corresponding to a given pair of characters in a font //////////////////////////////////////////////////////////// float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize) { @@ -135,8 +121,6 @@ float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned } -//////////////////////////////////////////////////////////// -/// Get the line spacing value //////////////////////////////////////////////////////////// float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize) { @@ -144,8 +128,6 @@ float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize) } -//////////////////////////////////////////////////////////// -/// Get the texture containing the glyphs of a given size in a font //////////////////////////////////////////////////////////// const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize) { From 62188c38ece5c90171819186cc313e07374174d3 Mon Sep 17 00:00:00 2001 From: Zachariah Brown Date: Mon, 23 Feb 2015 21:01:39 -0500 Subject: [PATCH 2/2] Added missing get underline thickness and position functions --- include/SFML/Graphics/Font.h | 27 +++++++++++++++++++++++++++ src/SFML/Graphics/Font.cpp | 14 ++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/SFML/Graphics/Font.h b/include/SFML/Graphics/Font.h index 2175294..88030af 100644 --- a/include/SFML/Graphics/Font.h +++ b/include/SFML/Graphics/Font.h @@ -121,6 +121,33 @@ CSFML_GRAPHICS_API float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint3 //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize); +//////////////////////////////////////////////////////////// +/// \brief Get the position of the underline +/// +/// Underline position is the vertical offset to apply between the +/// baseline and the underline. +/// +/// \param font Source font +/// \param characterSize Reference character size +/// +/// \return Underline position, in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_GRAPHICS_API float sfFont_getUnderlinePosition(sfFont* font, unsigned int characterSize); + +//////////////////////////////////////////////////////////// +/// \brief Get the thickness of the underline +/// +/// Underline thickness is the vertical size of the underline. +/// +/// \param font Source font +/// \param characterSize Reference character size +/// +/// \return Underline thickness, in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_GRAPHICS_API float sfFont_getUnderlineThickness(sfFont* font, unsigned int characterSize); + //////////////////////////////////////////////////////////// /// \brief Get the texture containing the glyphs of a given size in a font /// diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 6f003e9..b456382 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -128,6 +128,20 @@ float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize) } +//////////////////////////////////////////////////////////// +float sfFont_getUnderlinePosition(sfFont* font, unsigned int characterSize) +{ + CSFML_CALL_RETURN(font, getUnderlinePosition(characterSize), 0) +} + + +//////////////////////////////////////////////////////////// +float sfFont_getUnderlineThickness(sfFont* font, unsigned int characterSize) +{ + CSFML_CALL_RETURN(font, getUnderlineThickness(characterSize), 0) +} + + //////////////////////////////////////////////////////////// const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize) {