Compare commits

...

1 Commits

Author SHA1 Message Date
Matthias Clasen
0afcd0e833 Mark Arabic text as 'needs offscreen'
Arabic is a cursive script, and regularly has
overlapping contours between glyphs, which will
cause ugly artifacts when rendererd with translucency,
unless we use an offscreen.
2023-09-22 18:48:09 -04:00
3 changed files with 22 additions and 0 deletions

View File

@@ -5607,6 +5607,13 @@ gsk_text_node_new (PangoFont *font,
if (glyphs->glyphs[i].attr.is_color)
self->has_color_glyphs = TRUE;
if (i == 0 &&
(*(guint*)(&glyphs->glyphs[i].attr)) & (1 << 3))
{
g_print ("text node in Arabic\n");
node->offscreen_for_opacity = TRUE;
}
n++;
}

View File

@@ -1020,6 +1020,11 @@ parse_glyphs (GtkCssParser *parser,
gi.attr.is_color = 1;
else
gi.attr.is_color = 0;
if (gtk_css_parser_try_ident (parser, "need-offscreen"))
*((guint *)&gi.attr) |= (1 << 3);
else
*((guint *)&gi.attr) &= ~(1 << 3);
}
pango_glyph_string_set_size (glyph_string, glyph_string->num_glyphs + 1);
@@ -3288,6 +3293,8 @@ gsk_text_node_serialize_glyphs (GskRenderNode *node,
g_string_append (p, " same-cluster");
if (glyphs[i].attr.is_color)
g_string_append (p, " color");
if ((*(guint*)&glyphs[i].attr) & (1 << 3))
g_string_append (p, " needs-offscreen");
}
if (i + 1 < n_glyphs)

View File

@@ -97,6 +97,14 @@ gsk_pango_renderer_draw_glyph_item (PangoRenderer *renderer,
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
GdkRGBA color;
if (glyph_item->item->analysis.script == PANGO_SCRIPT_ARABIC)
{
g_print ("glyph item in arabic!\n");
*(guint*)&(glyph_item->glyphs->glyphs[0].attr) |= (1 << 3);
}
else
*(guint*)&(glyph_item->glyphs->glyphs[0].attr) &= ~(1 << 3);
get_color (crenderer, PANGO_RENDER_PART_FOREGROUND, &color);
gtk_snapshot_append_text (crenderer->snapshot,