summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-04-26 09:26:15 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-04-26 09:26:15 -0400
commit78265eb3b0879d1a609b609d62a32fb1ec61f3c9 (patch)
tree91d0c18051f2a082ce9751fbba4dd26079ec8903
parent6c19f331f29e7fb659f18856494c6cd6cbb3151e (diff)
More notes on glyphsglyph
-rw-r--r--glyphs.txt114
1 files changed, 114 insertions, 0 deletions
diff --git a/glyphs.txt b/glyphs.txt
index 95e6958e..564566e8 100644
--- a/glyphs.txt
+++ b/glyphs.txt
@@ -1,3 +1,117 @@
+New approach:
+
+Pixman has the concept of a glyph cache, and not the concept of a
+glyph set.
+
+API:
+
+pixman_glyph_cache_freeze();
+pixman_glyph_cache_thaw();
+bool pixman_glyph_cache_contains(cache, void *font, uint32_t index);
+void pixman_glyph_cache_insert(cache, void *font, uint32_t index,
+ format, x, y, data, ...);
+struct command
+{
+ union
+ {
+ struct
+ {
+ void *font;
+ } switch;
+
+ struct
+ {
+ int x, y;
+ } displace;
+
+ struct
+ {
+ uint32_t n_glyphs;
+ } glyphs;
+ } u;
+};
+
+pixman_glyph_commands_t *pixman_glyph_commands_begin (void *data, int n_bytes);
+
+pixman_glyph_commands_t *pixman_glyph_commands_switch (void *data, void *font);
+... *pixman_glyph_commands_displace (void *data, int x, int y);
+... *pixman_glyph_commands_glyphs (void *data, uint32_t n_glyphs,
+ uint32_t *indices);
+
+void *pixman_glyph_commands_end (void *data);
+void pixman_glyph_commands_free (void *data);
+
+
+void pixman_composite_glyphs(..., src, cache, commands, dst);
+
+To use it, you would do:
+
+ uint8_t data[1024];
+ uint32_t glyphs[N_STACK_GLYPHS];
+ uint32_t *g = glyphs;
+
+ pixman_glyph_commands_t *commands;
+
+ pixman_glyph_cache_freeze();
+
+ commands = pixman_glyph_commands_begin (data, sizeof (data));
+
+ for (i = 0; i < blah; ++i)
+ {
+ if (glyph)
+ {
+ if (g - glyphs == N_STACK_GLYPHS)
+ {
+ command = add_glyphs (command, font, glyphs, N_STACK_GLYPHS);
+ g = glyphs;
+ }
+ *g++ = index;
+ }
+ else
+ {
+ command = add_glyphs (command, font, glyphs, g - glyphs);
+ g = glyphs;
+
+ if (displace)
+ ...;
+ else if (font)
+ ...;
+ }
+ }
+
+ command = add_glyphs (command, font, glyphs, g - glyphs);
+ commands = pixman_glyph_commands_end (commands);
+
+ pixman_composite_glyphs (src, cache, commands, dst, ...);
+
+ pixman_glyph_commands_free (commands);
+
+
+In the X server, do we get any notification when a glyph disappears?
+Yes, we do in UnrealizeGlyph().
+
+We can be even simpler than this:
+
+pixman_glyph_cache_freeze();
+pixman_glyph_cache_thaw();
+bool pixman_glyph_cache_contains(cache, void *font, void *index);
+void pixman_glyph_cache_insert(cache, void *font, void *index,
+ format, x, y, data, ...);
+pixman_composite_glyphs (src,
+ void *font, void **indices, int n_indices,
+ pixman_format_t mask_format,
+ dst,
+ ...);
+
+where the X server void use NULL for font, and the glyph pointer for
+indices, and cairo would use scaled_font for font and the
+glyph_indices for the indices.
+
+mask_format would determine the format used for the mask, although
+another possibility would be to say that a8 glyphs are expanded to
+shades of white. Or saying that glyphs get added with a white source.
+
+
Glyphs in the X server
- Glyphsets are current global and not attached to a screen and