diff src/dispextern.h @ 110598:ee58b36ab139

Remove restriction on the number of glyphs in one composition.
author Kenichi Handa <handa@m17n.org>
date Mon, 27 Sep 2010 14:27:28 +0900
parents f67e6d84ff96
children 0e84d4500f6b
line wrap: on
line diff
--- a/src/dispextern.h	Wed Sep 22 11:56:28 2010 +0900
+++ b/src/dispextern.h	Mon Sep 27 14:27:28 2010 +0900
@@ -394,7 +394,15 @@
      w32_char_font_type.  Otherwise it equals FONT_TYPE_UNKNOWN.  */
   unsigned font_type : 3;
 
-  struct glyph_slice slice;
+  /* A union of sub-structures for different glyph types.  */
+  union
+  {
+    /* Metrics of a partial glyph of an image (type == IMAGE_GLYPH).  */
+    struct glyph_slice img;
+    /* Start and end indices of glyphs of a graphme cluster of a
+       composition (type == COMPOSITE_GLYPH).  */
+    struct { int from, to; } cmp;
+  } slice;
 
   /* A union of sub-structures for different glyph types.  */
   union
@@ -402,16 +410,13 @@
     /* Character code for character glyphs (type == CHAR_GLYPH).  */
     unsigned ch;
 
-    /* Sub-structures for type == COMPOSITION_GLYPH.  */
+    /* Sub-structures for type == COMPOSITE_GLYPH.  */
     struct
     {
       /* Flag to tell if the composition is automatic or not.  */
       unsigned automatic : 1;
       /* ID of the composition.  */
-      unsigned id    : 23;
-      /* Start and end indices of glyphs of the composition.  */
-      unsigned from : 4;
-      unsigned to : 4;
+      unsigned id    : 31;
     } cmp;
 
     /* Image ID for image glyphs (type == IMAGE_GLYPH).  */
@@ -443,13 +448,21 @@
 #define CHAR_GLYPH_SPACE_P(GLYPH) \
   ((GLYPH).u.ch == SPACEGLYPH && (GLYPH).face_id == DEFAULT_FACE_ID)
 
-/* Are glyph slices of glyphs *X and *Y equal */
-
-#define GLYPH_SLICE_EQUAL_P(X, Y)		\
-  ((X)->slice.x == (Y)->slice.x			\
-   && (X)->slice.y == (Y)->slice.y		\
-   && (X)->slice.width == (Y)->slice.width	\
-   && (X)->slice.height == (Y)->slice.height)
+/* Are glyph slices of glyphs *X and *Y equal?  It assumes that both
+   glyphs have the same type.
+
+   Note: for composition glyphs, we don't have to compare slice.cmp.to
+   because they should be the same if and only if slice.cmp.from are
+   the same.  */
+
+#define GLYPH_SLICE_EQUAL_P(X, Y)				\
+  ((X)->type == IMAGE_GLYPH					\
+   ? ((X)->slice.img.x == (Y)->slice.img.x			\
+      && (X)->slice.img.y == (Y)->slice.img.y			\
+      && (X)->slice.img.width == (Y)->slice.img.width		\
+      && (X)->slice.img.height == (Y)->slice.img.height)	\
+   : ((X)->type != COMPOSITE_GLYPH				\
+      || (X)->slice.cmp.from == (Y)->slice.cmp.from))
 
 /* Are glyphs *X and *Y displayed equal?  */