changeset 97821:9d12856db185

* dispextern.h (struct glyph): New union u.cmp. Delete the member cmp_id. (struct glyph_string): Delete the member gidx. New members cmp_id, cmp_from, and cmp_to. (enum it_method): Delete GET_FROM_COMPOSITION. (struct composition_it): New struct. (struct it): New member cmp_it, and iterator_stack_entry.cmp_it. Delete c, len, cmp_id, cmp_len in u.comp.
author Kenichi Handa <handa@m17n.org>
date Fri, 29 Aug 2008 07:54:09 +0000
parents 45062be75131
children f44734c99365
files src/dispextern.h
diffstat 1 files changed, 48 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispextern.h	Fri Aug 29 07:53:47 2008 +0000
+++ b/src/dispextern.h	Fri Aug 29 07:54:09 2008 +0000
@@ -274,7 +274,7 @@
   /* Glyph describes a character.  */
   CHAR_GLYPH,
 
-  /* Glyph describes a composition sequence.  */
+  /* Glyph describes a static composition.  */
   COMPOSITE_GLYPH,
 
   /* Glyph describes an image.  */
@@ -390,8 +390,17 @@
     /* Character code for character glyphs (type == CHAR_GLYPH).  */
     unsigned ch;
 
-    /* Composition ID for composition glyphs (type == COMPOSITION_GLYPH)  */
-    unsigned cmp_id;
+    /* Sub-structures for type == COMPOSITION_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 glyhs of the composition.  */
+      unsigned from : 4;
+      unsigned to : 4;
+    } cmp;
 
     /* Image ID for image glyphs (type == IMAGE_GLYPH).  */
     unsigned img_id;
@@ -1165,14 +1174,15 @@
   /* Font in which this string is to be drawn.  */
   struct font *font;
 
-  /* Non-null means this string describes (part of) a composition.
-     All characters from char2b are drawn composed.  */
+  /* Non-null means this string describes (part of) a static
+     composition.  */
   struct composition *cmp;
 
-  /* Index of this glyph string's first character in the glyph
-     definition of CMP.  If this is zero, this glyph string describes
-     the first character of a composition.  */
-  int gidx;
+  /* If not negative, this string describes a compos.  */
+  int cmp_id;
+
+  /* Start and end glyph indices in a glyph-string.  */
+  int cmp_from, cmp_to;
 
   /* 1 means this glyph strings face has to be drawn to the right end
      of the window's drawing area.  */
@@ -1774,7 +1784,7 @@
   /* A normal character.  */
   IT_CHARACTER,
 
-  /* A composition sequence.  */
+  /* A composition (static and automatic).  */
   IT_COMPOSITION,
 
   /* An image.  */
@@ -1838,7 +1848,6 @@
 enum it_method {
   GET_FROM_BUFFER = 0,
   GET_FROM_DISPLAY_VECTOR,
-  GET_FROM_COMPOSITION,
   GET_FROM_STRING,
   GET_FROM_C_STRING,
   GET_FROM_IMAGE,
@@ -1848,6 +1857,30 @@
 
 #define IT_STACK_SIZE 4
 
+/* Iterator for composition (both for static and automatic).  */
+struct composition_it
+{
+  /* Next position at which to check the composition.  */
+  EMACS_INT stop_pos;
+  /* ID number of the composition or glyph-string.  If negative, we
+     are not iterating over a composition now.  */
+  int id;
+  /* If non-negative, character that triggers the automatic
+     composition at `stop_pos', and this is an automatic compositoin.
+     If negative, this is a static composition..  */
+  int ch;
+  /* If non-negative, number of glyphs of the glyph-string.  */
+  int nglyphs;
+  /* Number of characters and bytes of the current grapheme cluster.  */
+  int nchars, nbytes;
+  /* Indices of the glyphs for the current grapheme cluster.  */
+  int from, to;
+  /* Width of the current grapheme cluster in units of pixels on a
+     graphic display and in units of canonical characters on a
+     terminal display.  */
+  int width;
+};
+
 struct it
 {
   /* The window in which we iterate over current_buffer (or a string).  */
@@ -1970,6 +2003,7 @@
     int string_nchars;
     int end_charpos;
     int stop_charpos;
+    struct composition_it cmp_it;
     int face_id;
 
     /* Save values specific to a given method.  */
@@ -1983,8 +2017,6 @@
       /* method == GET_FROM_COMPOSITION */
       struct {
 	Lisp_Object object;
-	int c, len;
-	int cmp_id, cmp_len;
       } comp;
       /* method == GET_FROM_STRETCH */
       struct {
@@ -2081,9 +2113,9 @@
      and length in bytes of the composition.  */
   int c, len;
 
-  /* If what == IT_COMPOSITION, identification number and length in
-     chars of a composition.  */
-  int cmp_id, cmp_len;
+  /* If what == IT_COMPOSITION, iterator substructure for the
+     composition.  */
+  struct composition_it cmp_it;
 
   /* The character to display, possibly translated to multibyte
      if unibyte_display_via_language_environment is set.  This