From a6a4f1eb2eb4ac0ab5d7d5cd0d5fd38d4dbc0658 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 8 Jul 2015 23:27:41 -0700 Subject: [PATCH] fix compile of dormant icu_shaper --- include/mapnik/text/icu_shaper.hpp | 35 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/include/mapnik/text/icu_shaper.hpp b/include/mapnik/text/icu_shaper.hpp index dedeafd81..bcd822b27 100644 --- a/include/mapnik/text/icu_shaper.hpp +++ b/include/mapnik/text/icu_shaper.hpp @@ -27,6 +27,10 @@ #include #include #include +#include +#include +#include +#include #include // stl @@ -59,12 +63,11 @@ static void shape_text(text_line & line, UErrorCode err = U_ZERO_ERROR; mapnik::value_unicode_string shaped; mapnik::value_unicode_string reordered; - unsigned char_index = 0; for (auto const& text_item : list) { - face_set_ptr face_set = font_manager.get_face_set(text_item.format->face_name, text_item.format->fontset); - double size = text_item.format->text_size * scale_factor; + face_set_ptr face_set = font_manager.get_face_set(text_item.format_->face_name, text_item.format_->fontset); + double size = text_item.format_->text_size * scale_factor; face_set->set_unscaled_character_sizes(); for (auto const& face : *face_set) { @@ -87,33 +90,35 @@ static void shape_text(text_line & line, std::size_t num_chars = static_cast(num_char); shaped.releaseBuffer(length); bool shaped_status = true; + double max_glyph_height = 0; if (U_SUCCESS(err) && (num_chars == length)) { + unsigned char_index = 0; U_NAMESPACE_QUALIFIER StringCharacterIterator iter(shaped); for (iter.setToStart(); iter.hasNext();) { UChar ch = iter.nextPostInc(); - glyph_info tmp; - tmp.glyph_index = FT_Get_Char_Index(face->get_face(), ch); - tmp.offset.clear(); - if (tmp.glyph_index == 0) + auto codepoint = FT_Get_Char_Index(face->get_face(), ch); + glyph_info g(codepoint,char_index,text_item.format_); + //g.offset.clear(); + if (g.glyph_index == 0) { shaped_status = false; break; } - if (face->glyph_dimensions(tmp)) + if (face->glyph_dimensions(g)) { - tmp.char_index = char_index; - tmp.face = face; - tmp.format = text_item.format; - tmp.scale_multiplier = size / face->get_face()->units_per_EM; - width_map[char_index++] += tmp.advance(); - line.add_glyph(tmp, scale_factor); + g.face = face; + g.scale_multiplier = size / face->get_face()->units_per_EM; + double tmp_height = g.height(); + if (tmp_height > max_glyph_height) max_glyph_height = tmp_height; + width_map[char_index++] += g.advance(); + line.add_glyph(std::move(g), scale_factor); } } } if (!shaped_status) continue; - line.update_max_char_height(face->get_char_height(size)); + line.update_max_char_height(max_glyph_height); return; } }