avoid division by zero (units_per_EM is set to 0 for bitmap fonts)
This commit is contained in:
parent
a6519c3f6b
commit
7c93514fbc
1 changed files with 6 additions and 1 deletions
|
@ -199,11 +199,16 @@ static void shape_text(text_line & line,
|
|||
if (theface->glyph_dimensions(g))
|
||||
{
|
||||
g.face = theface;
|
||||
g.scale_multiplier = size / theface->get_face()->units_per_EM;
|
||||
g.scale_multiplier = theface->get_face()->units_per_EM > 0 ?
|
||||
(size / theface->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())
|
||||
{
|
||||
tmp_height = size;
|
||||
}
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue