make cairo_context.add_text more like agg::text_renderer

This commit is contained in:
Dane Springmeyer 2014-10-11 13:08:28 -07:00
parent 51620e2b4d
commit b275144004
4 changed files with 10 additions and 10 deletions

View file

@ -319,7 +319,7 @@ public:
void restore();
void show_glyph(unsigned long index, pixel_position const& pos);
void glyph_path(unsigned long index, pixel_position const& pos);
void add_text(glyph_positions_ptr pos,
void add_text(glyph_positions const& pos,
cairo_face_manager & manager,
face_manager_freetype & font_manager,
composite_mode_e comp_op = src_over,

View file

@ -430,21 +430,21 @@ void cairo_context::glyph_path(unsigned long index, pixel_position const &pos)
check_object_status_and_throw_exception(*this);
}
void cairo_context::add_text(glyph_positions_ptr path,
void cairo_context::add_text(glyph_positions const& pos,
cairo_face_manager & manager,
face_manager_freetype & font_manager,
composite_mode_e comp_op,
composite_mode_e halo_comp_op,
double scale_factor)
{
pixel_position const& base_point = path->get_base_point();
pixel_position const& base_point = pos.get_base_point();
const double sx = base_point.x;
const double sy = base_point.y;
//render halo
double halo_radius = 0;
set_operator(halo_comp_op);
for (auto const& glyph_pos : *path)
for (auto const& glyph_pos : pos)
{
glyph_info const& glyph = glyph_pos.glyph;
face_set_ptr faces = font_manager.get_face_set(glyph.format->face_name, glyph.format->fontset);
@ -472,7 +472,7 @@ void cairo_context::add_text(glyph_positions_ptr path,
stroke();
}
set_operator(comp_op);
for (auto const& glyph_pos : *path)
for (auto const& glyph_pos : pos)
{
glyph_info const& glyph = glyph_pos.glyph;
face_set_ptr faces = font_manager.get_face_set(glyph.format->face_name, glyph.format->fontset);

View file

@ -80,7 +80,7 @@ struct thunk_renderer : public util::static_visitor<>
glyphs->marker()->transform,
thunk.opacity_, thunk.comp_op_);
}
context_.add_text(glyphs, face_manager_, common_.font_manager_, src_over, src_over, common_.scale_factor_);
context_.add_text(*glyphs, face_manager_, common_.font_manager_, src_over, src_over, common_.scale_factor_);
});
}

View file

@ -36,8 +36,8 @@ class proj_transform;
template <typename T>
void cairo_renderer<T>::process(shield_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
agg::trans_affine tr;
auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
@ -64,7 +64,7 @@ void cairo_renderer<T>::process(shield_symbolizer const& sym,
glyphs->marker()->transform,
opacity);
}
context_.add_text(glyphs, face_manager_, common_.font_manager_, comp_op, halo_comp_op, common_.scale_factor_);
context_.add_text(*glyphs, face_manager_, common_.font_manager_, comp_op, halo_comp_op, common_.scale_factor_);
}
}
@ -94,7 +94,7 @@ void cairo_renderer<T>::process(text_symbolizer const& sym,
placements_list const& placements = helper.get();
for (glyph_positions_ptr glyphs : placements)
{
context_.add_text(glyphs, face_manager_, common_.font_manager_, comp_op, halo_comp_op, common_.scale_factor_);
context_.add_text(*glyphs, face_manager_, common_.font_manager_, comp_op, halo_comp_op, common_.scale_factor_);
}
}