Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sfFont_hasGlyph #230

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
texus marked this conversation as resolved.
Show resolved Hide resolved
///
/// \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
Loading