From fe7d1e2f53e2de416e4f6dc5dd2dea8622a84141 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 17 Feb 2017 15:23:00 +0100 Subject: [PATCH] simplify logic --- include/mapnik/text/harfbuzz_shaper.hpp | 44 ++++++++----------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/include/mapnik/text/harfbuzz_shaper.hpp b/include/mapnik/text/harfbuzz_shaper.hpp index 9edf8eb87..a17ad870f 100644 --- a/include/mapnik/text/harfbuzz_shaper.hpp +++ b/include/mapnik/text/harfbuzz_shaper.hpp @@ -149,38 +149,22 @@ static void shape_text(text_line & line, } // if we have a valid codepoint, save rendering info. - if (glyphs[i].codepoint) - { - auto itr = glyphinfos.find(cluster); - if (itr == glyphinfos.end()) - { - std::vector v = {{ face, glyphs[i], positions[i] }}; - bool result = false; - std::tie(itr, result) = glyphinfos.insert(std::make_pair(cluster, v)); - } - if (itr->second.front().glyph.codepoint == 0) - { - itr->second.front() = { face, glyphs[i], positions[i] }; - } - else if (in_cluster) - { - itr->second.push_back({ face, glyphs[i], positions[i] }); - } - } - else + auto itr = glyphinfos.find(cluster); + if (itr == glyphinfos.end()) { - auto itr = glyphinfos.find(cluster); - if (itr == glyphinfos.end()) - { - std::vector v = {{ face, glyphs[i], positions[i] }}; - bool result = false; - std::tie(itr, result) = glyphinfos.insert(std::make_pair(cluster, v)); - } - if (itr != glyphinfos.end() && itr->second.front().glyph.codepoint == 0) - { - itr->second.front() = { face, glyphs[i], positions[i] }; - } + std::vector v = {{ face, glyphs[i], positions[i] }}; + bool result = false; + std::tie(itr, result) = glyphinfos.insert(std::make_pair(cluster, v)); + + } + if (itr->second.front().glyph.codepoint == 0) + { + itr->second.front() = { face, glyphs[i], positions[i] }; + } + else if (in_cluster) + { + itr->second.push_back({ face, glyphs[i], positions[i] }); } }