Added Font::hasGlyph()
This commit is contained in:
parent
f93372f98a
commit
43187455e4
@ -166,6 +166,10 @@ public:
|
||||
/// might be available. If the glyph is not available at the
|
||||
/// requested size, an empty glyph is returned.
|
||||
///
|
||||
/// You may want to use \ref hasGlyph to determine if the
|
||||
/// glyph exists before requesting it. If the glyph does not
|
||||
/// exist, a font specific default is returned.
|
||||
///
|
||||
/// Be aware that using a negative value for the outline
|
||||
/// thickness will cause distorted rendering.
|
||||
///
|
||||
@ -179,6 +183,24 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness = 0) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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 codePoint Unicode code point to check
|
||||
///
|
||||
/// \return True if the codepoint has a glyph representation, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool hasGlyph(Uint32 codePoint) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the kerning offset of two glyphs
|
||||
///
|
||||
|
@ -365,6 +365,13 @@ const Glyph& Font::getGlyph(Uint32 codePoint, unsigned int characterSize, bool b
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Font::hasGlyph(Uint32 codePoint) const
|
||||
{
|
||||
return FT_Get_Char_Index(static_cast<FT_Face>(m_face), codePoint) != 0;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
float Font::getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user