From f4bfdda745932628401ef91e7dcf776c7d1df668 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 12 Feb 2003 19:33:30 +0000 Subject: [PATCH] add FontCompleteForString --- stepmania/src/Font.cpp | 16 ++++++++++++++++ stepmania/src/Font.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index dd568918fb..1c241147ba 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -313,6 +313,22 @@ const glyph &Font::GetGlyph( wchar_t c ) const return *it->second; } +bool Font::FontCompleteForString( const wstring &str ) const +{ + map::const_iterator def = m_iCharToGlyph.find(DEFAULT_GLYPH); + if(def == m_iCharToGlyph.end()) + RageException::Throw( "The default glyph is missing from the font '%s'", path.GetString() ); + + for(unsigned i = 0; i < str.size(); ++i) + { + /* If the glyph for this character is the default glyph, we're incomplete. */ + const glyph &g = GetGlyph(str[i]); + if(&g == def->second) + return false; + } + return true; +} + void Font::CapsOnly() { /* For each uppercase character that we have a mapping for, add diff --git a/stepmania/src/Font.h b/stepmania/src/Font.h index fb37e1bee6..bf2a38d51c 100644 --- a/stepmania/src/Font.h +++ b/stepmania/src/Font.h @@ -110,6 +110,8 @@ public: int GetLineHeightInSourcePixels( const wstring &szLine ) const; int GetLineSpacingInSourcePixels( const wstring &szLine ) const; + bool FontCompleteForString( const wstring &str ) const; + /* Add a FontPage to this font. */ void AddPage(FontPage *fp);