From 1be3c8b2700b82d7a33ebae7a054e48c29096356 Mon Sep 17 00:00:00 2001 From: akir Date: Fri, 3 Sep 2004 14:17:47 +0000 Subject: cosmetic --- src/FbTk/Font.cc | 58 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc index 5665993..6ac7d74 100644 --- a/src/FbTk/Font.cc +++ b/src/FbTk/Font.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.cc,v 1.19 2004/09/01 00:09:03 akir Exp $ +//$Id: Font.cc,v 1.20 2004/09/03 14:17:47 akir Exp $ #include "StringUtil.hh" @@ -357,42 +357,44 @@ bool Font::load(const std::string &name) { // everything after ':' is a fontoption // -> extract 'halo' and 'shadow' and // load remaining fname - std::list< std::string > tokens; size_t sep= name.find_first_of(':'); - std::string fname; if ( sep != std::string::npos ) { + + std::list< std::string > tokens; + std::string fname; + fname= std::string(name.c_str(), sep + 1); FbTk::StringUtil::stringtok(tokens, name.substr(sep + 1, name.length()), ","); + + tokens.unique(); + bool firstone= true; + std::list< std::string >::const_iterator token; + + // check tokens and extract extraoptions for halo and shadow + for( token= tokens.begin(); token != tokens.end(); token++ ) { + if ( (*token).find("halo",0) != std::string::npos ) { + m_halo= true; + extract_halo_options(*token, m_halo_color); + } + else if ( (*token).find("shadow", 0) != std::string::npos ) { + m_shadow= true; + extract_shadow_options(*token, m_shadow_color, m_shadow_offx, m_shadow_offy); } - else - fname= name; - - tokens.unique(); - bool firstone= true; - std::list< std::string >::const_iterator token; - - // check tokens and extract extraoptions for halo and shadow - for( token= tokens.begin(); token != tokens.end(); token++ ) { - if ( (*token).find("halo",0) != std::string::npos ) { - m_halo= true; - extract_halo_options(*token, m_halo_color); - } - else if ( (*token).find("shadow", 0) != std::string::npos ) { - m_shadow= true; - extract_shadow_options(*token, m_shadow_color, m_shadow_offx, m_shadow_offy); + else { + if ( !firstone ) + fname+= ", "; + else + firstone= false; + fname= fname + *token; } - else { - if ( !firstone ) - fname+= ", "; - else - firstone= false; - fname= fname + *token; } - } - m_fontstr = fname; - return m_fontimp->load(fname.c_str()); + m_fontstr = fname; + } else + m_fontstr = name; + + return m_fontimp->load(m_fontstr.c_str()); } unsigned int Font::textWidth(const char * const text, unsigned int size) const { -- cgit v0.11.2