Added Font::getInfo to retrieve various information about the font (for now, only the family name) (#164)

This commit is contained in:
Laurent Gomila 2013-08-09 16:02:53 +02:00
parent 6d4c844959
commit 7caf2e64b6
2 changed files with 41 additions and 3 deletions

View file

@ -49,6 +49,17 @@ class InputStream;
////////////////////////////////////////////////////////////
class SFML_GRAPHICS_API Font
{
public :
////////////////////////////////////////////////////////////
/// \brief Holds various information about a font
///
////////////////////////////////////////////////////////////
struct Info
{
std::string family; ///< The font family
};
public :
////////////////////////////////////////////////////////////
@ -130,6 +141,14 @@ public :
////////////////////////////////////////////////////////////
bool loadFromStream(InputStream& stream);
////////////////////////////////////////////////////////////
/// \brief Get the font information
///
/// \return A structure that holds the font information
///
////////////////////////////////////////////////////////////
const Info& getInfo() const;
////////////////////////////////////////////////////////////
/// \brief Retrieve a glyph of the font
///
@ -283,7 +302,8 @@ private :
void* m_face; ///< Pointer to the internal font face (it is typeless to avoid exposing implementation details)
void* m_streamRec; ///< Pointer to the stream rec instance (it is typeless to avoid exposing implementation details)
int* m_refCount; ///< Reference counter used by implicit sharing
mutable PageTable m_pages; ///< Table containing the glyphs pages by character size
Info m_info; ///< Information about the font
mutable PageTable m_pages; ///< Table containing the glyphs pages by character size
mutable std::vector<Uint8> m_pixelBuffer; ///< Pixel buffer holding a glyph's pixels before being written to the texture
};