ensure insert has worked

This commit is contained in:
artemp 2017-02-17 15:40:37 +01:00
parent e55918788c
commit 20cafae780

View file

@ -151,20 +151,23 @@ static void shape_text(text_line & line,
// if we have a valid codepoint, save rendering info.
auto itr = glyphinfos.find(cluster);
bool status = true;
if (itr == glyphinfos.end())
{
std::vector<glyph_face_info> v = {{ face, glyphs[i], positions[i] }};
bool result = false;
std::tie(itr, result) = glyphinfos.insert(std::make_pair(cluster, v));
std::tie(itr, status) = glyphinfos.insert(std::make_pair(cluster, v));
}
if (itr->second.front().glyph.codepoint == 0)
if (status)
{
itr->second.front() = { face, glyphs[i], positions[i] };
}
else if (in_cluster)
{
itr->second.push_back({ face, glyphs[i], positions[i] });
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] });
}
}
}