aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Font.cc58
1 files 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 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22//$Id: Font.cc,v 1.19 2004/09/01 00:09:03 akir Exp $ 22//$Id: Font.cc,v 1.20 2004/09/03 14:17:47 akir Exp $
23 23
24 24
25#include "StringUtil.hh" 25#include "StringUtil.hh"
@@ -357,42 +357,44 @@ bool Font::load(const std::string &name) {
357 // everything after ':' is a fontoption 357 // everything after ':' is a fontoption
358 // -> extract 'halo' and 'shadow' and 358 // -> extract 'halo' and 'shadow' and
359 // load remaining fname 359 // load remaining fname
360 std::list< std::string > tokens;
361 size_t sep= name.find_first_of(':'); 360 size_t sep= name.find_first_of(':');
362 std::string fname;
363 361
364 if ( sep != std::string::npos ) { 362 if ( sep != std::string::npos ) {
363
364 std::list< std::string > tokens;
365 std::string fname;
366
365 fname= std::string(name.c_str(), sep + 1); 367 fname= std::string(name.c_str(), sep + 1);
366 FbTk::StringUtil::stringtok(tokens, name.substr(sep + 1, name.length()), ","); 368 FbTk::StringUtil::stringtok(tokens, name.substr(sep + 1, name.length()), ",");
369
370 tokens.unique();
371 bool firstone= true;
372 std::list< std::string >::const_iterator token;
373
374 // check tokens and extract extraoptions for halo and shadow
375 for( token= tokens.begin(); token != tokens.end(); token++ ) {
376 if ( (*token).find("halo",0) != std::string::npos ) {
377 m_halo= true;
378 extract_halo_options(*token, m_halo_color);
379 }
380 else if ( (*token).find("shadow", 0) != std::string::npos ) {
381 m_shadow= true;
382 extract_shadow_options(*token, m_shadow_color, m_shadow_offx, m_shadow_offy);
367 } 383 }
368 else 384 else {
369 fname= name; 385 if ( !firstone )
370 386 fname+= ", ";
371 tokens.unique(); 387 else
372 bool firstone= true; 388 firstone= false;
373 std::list< std::string >::const_iterator token; 389 fname= fname + *token;
374
375 // check tokens and extract extraoptions for halo and shadow
376 for( token= tokens.begin(); token != tokens.end(); token++ ) {
377 if ( (*token).find("halo",0) != std::string::npos ) {
378 m_halo= true;
379 extract_halo_options(*token, m_halo_color);
380 }
381 else if ( (*token).find("shadow", 0) != std::string::npos ) {
382 m_shadow= true;
383 extract_shadow_options(*token, m_shadow_color, m_shadow_offx, m_shadow_offy);
384 } 390 }
385 else {
386 if ( !firstone )
387 fname+= ", ";
388 else
389 firstone= false;
390 fname= fname + *token;
391 } 391 }
392 }
393 392
394 m_fontstr = fname; 393 m_fontstr = fname;
395 return m_fontimp->load(fname.c_str()); 394 } else
395 m_fontstr = name;
396
397 return m_fontimp->load(m_fontstr.c_str());
396} 398}
397 399
398unsigned int Font::textWidth(const char * const text, unsigned int size) const { 400unsigned int Font::textWidth(const char * const text, unsigned int size) const {