emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101640: Remove restriction on the nu


From: Kenichi Handa
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101640: Remove restriction on the number of glyphs in one composition.
Date: Mon, 27 Sep 2010 14:55:41 +0900
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101640 [merge]
committer: Kenichi Handa <address@hidden>
branch nick: trunk
timestamp: Mon 2010-09-27 14:55:41 +0900
message:
  Remove restriction on the number of glyphs in one composition.
modified:
  src/ChangeLog
  src/dispextern.h
  src/dispnew.c
  src/term.c
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-09-26 20:48:13 +0000
+++ b/src/ChangeLog     2010-09-27 05:42:43 +0000
@@ -1,3 +1,29 @@
+2010-09-27  Kenichi Handa  <address@hidden>
+
+       These changes are to remove restriction on the number of glyphs in
+       one composition.
+
+       * dispextern.h (struct glyph): Change the member "slice" to union.
+       Remove u.cmp.from and u.cmp.to.  Give more bits to u.cmp.id.
+       (GLYPH_SLICE_EQUAL_P): Adjusted for the above change.
+
+       * dispnew.c (buffer_posn_from_coords): Use glyph->slice.img
+       instead of glyph->slice.
+       (marginal_area_string): Likewise.
+
+       * term.c (encode_terminal_code): Use glyph->slice.cmp instead of
+       glyph->u.cmp.
+       (append_composite_glyph): Likewise.
+
+       * xdisp.c (dump_glyph): Use glyph->slice.cmp instead of
+       glyph->u.cmp.
+       (fill_gstring_glyph_string, x_get_glyph_overhangs)
+       (append_composite_glyph): Likewise.
+       (fill_image_glyph_string): Use glyph->slice.img instead of
+       glyph->slice.
+       (append_glyph, produce_image_glyph, append_stretch_glyph)
+       (note_mouse_highlight): Likewise.
+
 2010-09-26  Jan Djärv  <address@hidden>
 
        * process.c (add_keyboard_wait_descriptor)

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2010-09-25 16:39:13 +0000
+++ b/src/dispextern.h  2010-09-27 05:42:43 +0000
@@ -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?  */
 

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2010-09-24 17:48:10 +0000
+++ b/src/dispnew.c     2010-09-27 05:42:43 +0000
@@ -5460,8 +5460,8 @@
          if (img)
            {
              *dy -= row->ascent - glyph->ascent;
-             *dx += glyph->slice.x;
-             *dy += glyph->slice.y;
+             *dx += glyph->slice.img.x;
+             *dy += glyph->slice.img.y;
              /* Image slices positions are still relative to the entire image 
*/
              *width = img->width;
              *height = img->height;
@@ -5627,8 +5627,8 @@
              if (img != NULL)
                *object = img->spec;
              y0 -= row->ascent - glyph->ascent;
-             x0 += glyph->slice.x;
-             y0 += glyph->slice.y;
+             x0 += glyph->slice.img.x;
+             y0 += glyph->slice.img.y;
            }
 #endif
        }

=== modified file 'src/term.c'
--- a/src/term.c        2010-09-26 15:06:21 +0000
+++ b/src/term.c        2010-09-27 05:42:43 +0000
@@ -594,7 +594,7 @@
          if (src->u.cmp.automatic)
            {
              gstring = composition_gstring_from_id (src->u.cmp.id);
-             required = src->u.cmp.to + 1 - src->u.cmp.from;
+             required = src->slice.cmp.to + 1 - src->slice.cmp.from;
            }
          else
            {
@@ -611,7 +611,7 @@
            }
 
          if (src->u.cmp.automatic)
-           for (i = src->u.cmp.from; i <= src->u.cmp.to; i++)
+           for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++)
              {
                Lisp_Object g = LGSTRING_GLYPH (gstring, i);
                int c = LGLYPH_CHAR (g);
@@ -1791,8 +1791,8 @@
        {
          glyph->u.cmp.automatic = 1;
          glyph->u.cmp.id = it->cmp_it.id;
-         glyph->u.cmp.from = it->cmp_it.from;
-         glyph->u.cmp.to = it->cmp_it.to - 1;
+         glyph->slice.cmp.from = it->cmp_it.from;
+         glyph->slice.cmp.to = it->cmp_it.to - 1;
        }
 
       glyph->face_id = it->face_id;

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2010-09-25 16:39:13 +0000
+++ b/src/xdisp.c       2010-09-27 05:42:43 +0000
@@ -16219,7 +16219,7 @@
       if (glyph->u.cmp.automatic)
        fprintf (stderr,
                 "[%d-%d]",
-                glyph->u.cmp.from, glyph->u.cmp.to);
+                glyph->slice.cmp.from, glyph->slice.cmp.to);
       fprintf (stderr, " . %4d %1.1d%1.1d\n",
               glyph->face_id,
               glyph->left_box_line_p,
@@ -20605,8 +20605,8 @@
   glyph = s->row->glyphs[s->area] + start;
   last = s->row->glyphs[s->area] + end;
   s->cmp_id = glyph->u.cmp.id;
-  s->cmp_from = glyph->u.cmp.from;
-  s->cmp_to = glyph->u.cmp.to + 1;
+  s->cmp_from = glyph->slice.cmp.from;
+  s->cmp_to = glyph->slice.cmp.to + 1;
   s->face = FACE_FROM_ID (s->f, face_id);
   lgstring = composition_gstring_from_id (s->cmp_id);
   s->font = XFONT_OBJECT (LGSTRING_FONT (lgstring));
@@ -20614,8 +20614,8 @@
   while (glyph < last
         && glyph->u.cmp.automatic
         && glyph->u.cmp.id == s->cmp_id
-        && s->cmp_to == glyph->u.cmp.from)
-    s->cmp_to = (glyph++)->u.cmp.to + 1;
+        && s->cmp_to == glyph->slice.cmp.from)
+    s->cmp_to = (glyph++)->slice.cmp.to + 1;
 
   for (i = s->cmp_from; i < s->cmp_to; i++)
     {
@@ -20705,7 +20705,7 @@
   xassert (s->first_glyph->type == IMAGE_GLYPH);
   s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id);
   xassert (s->img);
-  s->slice = s->first_glyph->slice;
+  s->slice = s->first_glyph->slice.img;
   s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
   s->font = s->face->font;
   s->width = s->first_glyph->pixel_width;
@@ -20811,8 +20811,8 @@
          Lisp_Object gstring = composition_gstring_from_id (glyph->u.cmp.id);
          struct font_metrics metrics;
 
-         composition_gstring_width (gstring, glyph->u.cmp.from,
-                                    glyph->u.cmp.to + 1, &metrics);
+         composition_gstring_width (gstring, glyph->slice.cmp.from,
+                                    glyph->slice.cmp.to + 1, &metrics);
          if (metrics.rbearing > metrics.width)
            *right = metrics.rbearing - metrics.width;
          if (metrics.lbearing < 0)
@@ -21517,7 +21517,7 @@
       glyph->glyph_not_available_p = it->glyph_not_available_p;
       glyph->face_id = it->face_id;
       glyph->u.ch = it->char_to_display;
-      glyph->slice = null_glyph_slice;
+      glyph->slice.img = null_glyph_slice;
       glyph->font_type = FONT_TYPE_UNKNOWN;
       if (it->bidi_p)
        {
@@ -21574,13 +21574,14 @@
        {
          glyph->u.cmp.automatic = 0;
          glyph->u.cmp.id = it->cmp_it.id;
+         glyph->slice.cmp.from = glyph->slice.cmp.to = 0;
        }
       else
        {
          glyph->u.cmp.automatic = 1;
          glyph->u.cmp.id = it->cmp_it.id;
-         glyph->u.cmp.from = it->cmp_it.from;
-         glyph->u.cmp.to = it->cmp_it.to - 1;
+         glyph->slice.cmp.from = it->cmp_it.from;
+         glyph->slice.cmp.to = it->cmp_it.to - 1;
        }
       glyph->avoid_cursor_p = it->avoid_cursor_p;
       glyph->multibyte_p = it->multibyte_p;
@@ -21591,7 +21592,6 @@
       glyph->padding_p = 0;
       glyph->glyph_not_available_p = 0;
       glyph->face_id = it->face_id;
-      glyph->slice = null_glyph_slice;
       glyph->font_type = FONT_TYPE_UNKNOWN;
       if (it->bidi_p)
        {
@@ -21770,7 +21770,7 @@
          glyph->glyph_not_available_p = 0;
          glyph->face_id = it->face_id;
          glyph->u.img_id = img->id;
-         glyph->slice = slice;
+         glyph->slice.img = slice;
          glyph->font_type = FONT_TYPE_UNKNOWN;
          if (it->bidi_p)
            {
@@ -21831,7 +21831,7 @@
       glyph->face_id = it->face_id;
       glyph->u.stretch.ascent = ascent;
       glyph->u.stretch.height = height;
-      glyph->slice = null_glyph_slice;
+      glyph->slice.img = null_glyph_slice;
       glyph->font_type = FONT_TYPE_UNKNOWN;
       if (it->bidi_p)
        {
@@ -24519,8 +24519,8 @@
              if ((image_map = Fplist_get (XCDR (img->spec), QCmap),
                   !NILP (image_map))
                  && (hotspot = find_hot_spot (image_map,
-                                              glyph->slice.x + dx,
-                                              glyph->slice.y + dy),
+                                              glyph->slice.img.x + dx,
+                                              glyph->slice.img.y + dy),
                      CONSP (hotspot))
                  && (hotspot = XCDR (hotspot), CONSP (hotspot)))
                {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]