Show
Ignore:
Timestamp:
06/29/08 06:58:48 (6 months ago)
Author:
artem
Message:

applied font fallback patch from Beau Gunderson

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/agg_renderer.cpp

    r703 r704  
    3030#include <mapnik/arrow.hpp> 
    3131#include <mapnik/config_error.hpp> 
     32#include <mapnik/font_set.hpp> 
    3233 
    3334// agg 
     
    281282               frame->move_to(itr->get<0>(),itr->get<1>()); 
    282283               frame->line_to(itr->get<0>(),itr->get<1>()+height);    
    283                 
    284284            } 
    285285             
     
    311311            ren.color(agg::rgba8(r, g, b, int(255 * sym.get_opacity()))); 
    312312            agg::render_scanlines(*ras_ptr, sl, ren); 
    313              
    314313         } 
    315314      } 
     
    461460      if (text.length() > 0 && data) 
    462461      { 
    463          face_ptr face = font_manager_.get_face(sym.get_face_name()); 
    464          if (face) 
    465          { 
    466             text_renderer<mapnik::Image32> ren(pixmap_,face); 
     462         std::vector<face_ptr> faces; 
     463                         
     464         faces.push_back(font_manager_.get_face(sym.get_face_name())); 
     465          
     466         if (faces.size() > 0) 
     467         { 
     468            text_renderer<mapnik::Image32> ren(pixmap_, faces); 
     469             
    467470            ren.set_pixel_size(sym.get_text_size()); 
    468471            ren.set_fill(sym.get_fill()); 
    469472             
    470473            string_info info(text); 
    471             face->get_string_info(info); 
     474 
     475            ren.get_string_info(info); 
    472476             
    473477            placement_finder<label_collision_detector4> finder(detector_); 
     
    670674      if ( text.length() > 0 ) 
    671675      { 
    672          Color const& fill  = sym.get_fill(); 
    673          face_ptr face = font_manager_.get_face(sym.get_face_name()); 
    674          if (face) 
    675          { 
    676             text_renderer<mapnik::Image32> ren(pixmap_,face); 
     676         Color const& fill = sym.get_fill(); 
     677 
     678         std::vector<face_ptr> faces; 
     679     
     680         FontSet fontset = sym.get_fontset(); 
     681         std::vector<std::string> face_names = fontset.get_face_names(); 
     682     
     683         if (face_names.size() > 0) 
     684         { 
     685            std::vector<std::string>::iterator itr = face_names.begin(); 
     686            std::vector<std::string>::iterator end = face_names.end(); 
     687 
     688            for (; itr != end; ++itr) 
     689            { 
     690               faces.push_back(font_manager_.get_face(*itr)); 
     691            } 
     692         } 
     693         else  
     694         { 
     695            faces.push_back(font_manager_.get_face(sym.get_face_name())); 
     696         } 
     697      
     698         if (faces.size() > 0) 
     699         { 
     700            text_renderer<mapnik::Image32> ren(pixmap_, faces); 
    677701            ren.set_pixel_size(sym.get_text_size()); 
    678702            ren.set_fill(fill); 
     
    683707            
    684708            string_info info(text); 
    685             face->get_string_info(info); 
     709             
     710            ren.get_string_info(info); 
    686711            unsigned num_geom = feature.num_geometries(); 
    687712            for (unsigned i=0;i<num_geom;++i)