[cairo-commit] src/cairo.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Jun 29 12:01:23 PDT 2008


 src/cairo.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 17a5f10f5342ae6b946ad7491f6656a43df66aa3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jun 29 15:00:10 2008 -0400

    [show_text_glyphs] Allow clusters with zero text
    
    As Adrian points out, PDF can handle it, and it doesn't harm allowing.

diff --git a/src/cairo.c b/src/cairo.c
index f55d78f..2dc1acc 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -3236,11 +3236,16 @@ cairo_show_text_glyphs (cairo_t			   *cr,
 	    int cluster_bytes  = clusters[i].num_bytes;
 	    int cluster_glyphs = clusters[i].num_glyphs;
 
-	    /* A cluster should cover at least one byte.
+	    if (cluster_bytes < 0 || cluster_glyphs < 0)
+	        goto BAD;
+
+	    /* A cluster should cover at least one character or glyph.
 	     * I can't see any use for a 0,0 cluster.
+	     * I can't see an immediate use for a zero-text cluster
+	     * right now either, but they don't harm.
 	     * Zero-glyph clusters on the other hand are useful for
 	     * things like U+200C ZERO WIDTH NON-JOINER */
-	    if (cluster_bytes < 1 || cluster_glyphs < 0)
+	    if (cluster_bytes == 0 && cluster_glyphs == 0)
 	        goto BAD;
 
 	    /* Since n_bytes and n_glyphs are unsigned, but the rest of


More information about the cairo-commit mailing list