mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 17:01:17 +01:00
raster: fix winding carry for edges left of the surface
When an edge fell to the left of the rendering surface (col < 0), cell_add() discarded its winding contribution entirely. For glyphs whose outlines extend beyond the surface bounds (e.g. COLR v1 spliceMask clip glyphs), this caused the interior winding number to stay zero, producing empty rasterizations. Fix by forwarding the cover delta to column 0 so the left-to-right sweep picks up the correct accumulated winding. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
87c8946640
commit
d7d17ee055
2 files changed
+13
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in new issue
Block a user