Added Font::getInfo to retrieve various information about the font (for now, only the family name) (#164)
This commit is contained in:
parent
6d4c844959
commit
7caf2e64b6
2 changed files with 41 additions and 3 deletions
|
@ -67,7 +67,8 @@ Font::Font() :
|
|||
m_library (NULL),
|
||||
m_face (NULL),
|
||||
m_streamRec(NULL),
|
||||
m_refCount (NULL)
|
||||
m_refCount (NULL),
|
||||
m_info ()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -79,6 +80,7 @@ m_library (copy.m_library),
|
|||
m_face (copy.m_face),
|
||||
m_streamRec (copy.m_streamRec),
|
||||
m_refCount (copy.m_refCount),
|
||||
m_info (copy.m_info),
|
||||
m_pages (copy.m_pages),
|
||||
m_pixelBuffer(copy.m_pixelBuffer)
|
||||
{
|
||||
|
@ -123,7 +125,7 @@ bool Font::loadFromFile(const std::string& filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Select the unicode character map
|
||||
// Select the unicode character map
|
||||
if (FT_Select_Charmap(face, FT_ENCODING_UNICODE) != 0)
|
||||
{
|
||||
err() << "Failed to load font \"" << filename << "\" (failed to set the Unicode character set)" << std::endl;
|
||||
|
@ -133,6 +135,9 @@ bool Font::loadFromFile(const std::string& filename)
|
|||
// Store the loaded font in our ugly void* :)
|
||||
m_face = face;
|
||||
|
||||
// Store the font information
|
||||
m_info.family = face->family_name ? face->family_name : std::string();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -173,6 +178,9 @@ bool Font::loadFromMemory(const void* data, std::size_t sizeInBytes)
|
|||
// Store the loaded font in our ugly void* :)
|
||||
m_face = face;
|
||||
|
||||
// Store the font information
|
||||
m_info.family = face->family_name ? face->family_name : std::string();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -233,10 +241,20 @@ bool Font::loadFromStream(InputStream& stream)
|
|||
m_face = face;
|
||||
m_streamRec = rec;
|
||||
|
||||
// Store the font information
|
||||
m_info.family = face->family_name ? face->family_name : std::string();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
const Font::Info& Font::getInfo() const
|
||||
{
|
||||
return m_info;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
const Glyph& Font::getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue