mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
b0e8d8483d
This commit takes several steps towards rendering text like we want to. The creation of the cairo surface and texture is moved to the backend (in GskVulkanRenderer). We add a mask shader that is used in the next text pipeline to use the texture as a mask, like cairo_mask_surface does. There is a separate color text pipeline that uses the already existing blend shaders to use the texture as a source, like cairo_paint does. The text node api is simplified to have just a single offset, which determines the left end of the text baseline, like all our other text drawing APIs.
38 lines
660 B
C
38 lines
660 B
C
#include "gskresources.h"
|
|
#include "gskprivate.h"
|
|
|
|
static gpointer
|
|
register_resources (gpointer data)
|
|
{
|
|
_gsk_register_resource ();
|
|
return NULL;
|
|
}
|
|
|
|
void
|
|
gsk_ensure_resources (void)
|
|
{
|
|
static GOnce register_resources_once = G_ONCE_INIT;
|
|
|
|
g_once (®ister_resources_once, register_resources, NULL);
|
|
}
|
|
|
|
int
|
|
pango_glyph_string_num_glyphs (PangoGlyphString *glyphs)
|
|
{
|
|
int i, count;
|
|
|
|
count = 0;
|
|
for (i = 0; i < glyphs->num_glyphs; i++)
|
|
{
|
|
PangoGlyphInfo *gi = &glyphs->glyphs[i];
|
|
if (gi->glyph != PANGO_GLYPH_EMPTY)
|
|
{
|
|
if (!(gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG))
|
|
count++;
|
|
}
|
|
}
|
|
|
|
return count;
|
|
}
|
|
|