From df0040791ee93c8eaac341e59336815c915e9a4d Mon Sep 17 00:00:00 2001 From: Shane Whitmire Date: Mon, 3 Jul 2023 19:11:59 -0500 Subject: [PATCH] Implement fetching bold kerning C doesn't have function overloading, so I had to resort to function name signature changes to resemble overloading. I think this is an ok way to do this --- include/SFML/Graphics/Font.h | 13 +++++++++++++ src/SFML/Graphics/Font.cpp | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/include/SFML/Graphics/Font.h b/include/SFML/Graphics/Font.h index 32f456b..84455a8 100644 --- a/include/SFML/Graphics/Font.h +++ b/include/SFML/Graphics/Font.h @@ -112,6 +112,19 @@ CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(const sfFont* font, sfUint32 codePoin //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfFont_getKerning(const sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize); +//////////////////////////////////////////////////////////// +/// \brief Get the bold kerning value corresponding to a given pair of characters in a font +/// +/// \param font Source font +/// \param first Unicode code point of the first character +/// \param second Unicode code point of the second character +/// \param characterSize Character size, in pixels +/// +/// \return Kerning offset, in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_GRAPHICS_API float sfFont_getBoldKerning(const sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize); + //////////////////////////////////////////////////////////// /// \brief Get the line spacing value /// diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 58dd8d9..c647604 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -121,6 +121,13 @@ float sfFont_getKerning(const sfFont* font, sfUint32 first, sfUint32 second, uns } +//////////////////////////////////////////////////////////// +float sfFont_getBoldKerning(const sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize) +{ + CSFML_CALL_RETURN(font, getKerning(first, second, characterSize, true), 0); +} + + //////////////////////////////////////////////////////////// float sfFont_getLineSpacing(const sfFont* font, unsigned int characterSize) {