diff --git a/src/hb-raster-draw.cc b/src/hb-raster-draw.cc index 48a018fe8..1010a971f 100644 --- a/src/hb-raster-draw.cc +++ b/src/hb-raster-draw.cc @@ -887,6 +887,18 @@ cell_add (int32_t *area, int16_t *cover, unsigned width, int col, int32_t fx0, int32_t fy0, int32_t fx1, int32_t fy1, int32_t wind, unsigned &x_min, unsigned &x_max) { + if (col < 0) + { + /* Edge is to the left of the surface. The winding contribution + * still carries into the visible region, so add the cover delta + * to column 0. Area is not added since the edge doesn't cross + * column 0's cell. */ + int32_t dy = fy1 - fy0; + cover[0] += (int16_t) (dy * wind); + x_min = hb_min (x_min, 0u); + x_max = hb_max (x_max, 0u); + return; + } if ((unsigned) col >= width) return; int32_t dy = fy1 - fy0; area[col] += (fx0 + fx1) * dy * wind; diff --git a/src/hb-raster-paint.cc b/src/hb-raster-paint.cc index 7fa661597..73eab8368 100644 --- a/src/hb-raster-paint.cc +++ b/src/hb-raster-paint.cc @@ -147,6 +147,7 @@ hb_raster_paint_push_clip_glyph (hb_paint_funcs_t *pfuncs HB_UNUSED, hb_font_draw_glyph (font, glyph, hb_raster_draw_get_funcs (), rdr); hb_raster_image_t *mask_img = hb_raster_draw_render (rdr); + if (unlikely (!mask_img)) { /* If mask rendering fails, push a fully transparent clip */