diff --git a/include/mapnik/text/glyph_info.hpp b/include/mapnik/text/glyph_info.hpp index 89f4fb407..274da1758 100644 --- a/include/mapnik/text/glyph_info.hpp +++ b/include/mapnik/text/glyph_info.hpp @@ -52,6 +52,9 @@ struct glyph_info double ymax; double line_height; + double offset_x; + double offset_y; + char_properties_ptr format; double height() const { return ymax-ymin; } diff --git a/src/text/layout.cpp b/src/text/layout.cpp index 6d7fb72ad..2833aa885 100644 --- a/src/text/layout.cpp +++ b/src/text/layout.cpp @@ -79,10 +79,13 @@ void text_layout::shape_text() tmp.char_index = glyphs[i].cluster; tmp.glyph_index = glyphs[i].codepoint; tmp.width = positions[i].x_advance / 64.0; + tmp.offset_x = positions[i].x_offset / 64.0; + tmp.offset_y = positions[i].y_offset / 64.0; tmp.face = face; tmp.format = itr->format; face->glyph_dimensions(tmp); glyphs_.push_back(tmp); + std::cout << "glyph:" << glyphs[i].mask << " xa:" << positions[i].x_advance << " ya:" << positions[i].y_advance << " xo:" << positions[i].x_offset << " yo:" << positions[i].y_offset << "\n"; } } std::cout << "text_length: unicode chars: " << itemizer.get_text().length() << " glyphs: " << glyphs_.size() << "\n"; @@ -104,6 +107,7 @@ void text_layout::clear() glyphs_.clear(); } +#if 0 format_run::format_run(char_properties_ptr properties, double text_height) : properties_(properties), glyphs_(), width_(0), text_height_(text_height), line_height_(0) { @@ -127,5 +131,6 @@ void text_line::add_run(format_run_ptr run) max_text_height = std::max(max_text_height, run->text_height()); runs_.push_back(run); } +#endif } //ns mapnik diff --git a/src/text/renderer.cpp b/src/text/renderer.cpp index 5c2d4ea96..df4369a25 100644 --- a/src/text/renderer.cpp +++ b/src/text/renderer.cpp @@ -38,13 +38,13 @@ void text_renderer::prepare_glyphs(glyph_positions_ptr pos) } while (pos->next()) { - pixel_position p = pos->get_position(); - pen.x = int(p.x * 64); - pen.y = int(p.y * 64); - glyph_info const& glyph = pos->get_glyph(); glyph.face->set_character_sizes(glyph.format->text_size); //TODO: Optimize this? + pixel_position p = pos->get_position(); + pen.x = int((p.x +glyph.offset_x) * 64); + pen.y = int((p.y + glyph.offset_y) * 64); + if (!constant_angle) { double angle = pos->get_angle();