Skip to content

Commit

Permalink
Added sfFont_hasGlyph
Browse files Browse the repository at this point in the history
  • Loading branch information
texus committed Feb 19, 2024
1 parent 8074b3a commit a2875a1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/SFML/Graphics/Font.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ CSFML_GRAPHICS_API void sfFont_destroy(sfFont* font);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(const sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold, float outlineThickness);

////////////////////////////////////////////////////////////
/// \brief Determine if this font has a glyph representing the requested code point
///
/// Most fonts only include a very limited selection of glyphs from
/// specific Unicode subsets, like Latin, Cyrillic, or Asian characters.
///
/// While code points without representation will return a font specific
/// default character, it might be useful to verify whether specific
/// code points are included to determine whether a font is suited
/// to display text in a specific language.
///
/// \param font Source font
/// \param codePoint Unicode code point to check
///
/// \return sfTrue if the codepoint has a glyph representation, sfFalse otherwise
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfFont_hasGlyph(const sfFont* font, sfUint32 codePoint);

////////////////////////////////////////////////////////////
/// \brief Get the kerning value corresponding to a given pair of characters in a font
///
Expand Down
7 changes: 7 additions & 0 deletions src/SFML/Graphics/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ sfGlyph sfFont_getGlyph(const sfFont* font, sfUint32 codePoint, unsigned int cha
}


////////////////////////////////////////////////////////////
sfBool sfFont_hasGlyph(const sfFont* font, sfUint32 codePoint)
{
CSFML_CALL_RETURN(font, hasGlyph(codePoint), sfFalse);
}


////////////////////////////////////////////////////////////
float sfFont_getKerning(const sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize)
{
Expand Down

0 comments on commit a2875a1

Please sign in to comment.