minimise shared_ptr assignments and simplify code

This commit is contained in:
artemp 2017-03-01 12:59:34 +01:00
parent d29be8a689
commit 04dd05c971

View file

@ -187,25 +187,21 @@ static void shape_text(text_line & line,
auto const& c = glyphinfos[c_id];
for (auto const& info : c)
{
face_ptr theface = face;
auto const& gpos = info.position;
auto const& glyph = info.glyph;
if (info.glyph.codepoint != 0)
{
theface = info.face;
}
unsigned char_index = glyph.cluster;
glyph_info g(glyph.codepoint,char_index,text_item.format_);
if (theface->glyph_dimensions(g))
if (info.glyph.codepoint != 0) g.face = info.face;
else g.face = face;
if (g.face->glyph_dimensions(g))
{
g.face = theface;
g.scale_multiplier = theface->get_face()->units_per_EM > 0 ?
(size / theface->get_face()->units_per_EM) : (size / 2048.0) ;
g.scale_multiplier = g.face->get_face()->units_per_EM > 0 ?
(size / g.face->get_face()->units_per_EM) : (size / 2048.0) ;
//Overwrite default advance with better value provided by HarfBuzz
g.unscaled_advance = gpos.x_advance;
g.offset.set(gpos.x_offset * g.scale_multiplier, gpos.y_offset * g.scale_multiplier);
double tmp_height = g.height();
if (theface->is_color())
if (g.face->is_color())
{
tmp_height = size;
}