emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/w32uniscribe.c,v


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32uniscribe.c,v
Date: Sun, 06 Apr 2008 14:28:37 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jason Rumney <jasonr>   08/04/06 14:28:36

Index: w32uniscribe.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32uniscribe.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- w32uniscribe.c      6 Apr 2008 01:04:45 -0000       1.7
+++ w32uniscribe.c      6 Apr 2008 14:28:36 -0000       1.8
@@ -307,12 +307,10 @@
                                advances, offsets, &overall_metrics);
          if (result == 0) /* Success.  */
            {
-             int j, nclusters, from = 0, to = 0;
-             /* For tracking our mapping of characters to glyphs.
-                Special value -1 means not yet initialized, -2 means
-                we've run off the end.  Anything else is an index
-                into the chars and clusters arrays.  */
-             int my_char = -1;
+             int j, nclusters, from, to;
+
+             from = rtl > 0 ? 0 : nchars_in_run - 1;
+             to = from;
 
              for (j = 0; j < nglyphs; j++)
                {
@@ -330,62 +328,33 @@
                  /* Detect clusters, for linking codes back to characters.  */
                  if (attributes[j].fClusterStart)
                    {
-                     /* First time, set to appropriate end of run.  */
-                     if (my_char == -1)
-                       my_char = rtl > 0 ? 0 : nchars_in_run - 1;
-                     else if (my_char >= 0)
-                       my_char += rtl;
-                     while (my_char >= 0 && my_char < nchars_in_run
-                            && clusters[my_char] < j)
-                       my_char += rtl;
-
-                     if (my_char < 0 || my_char >= nchars_in_run)
-                       my_char = -2;
-
-                     /* FROM and TO as char indices.  This produces
-                        much better results at small font sizes than
-                        earlier attempts at using glyph indices for
-                        FROM and TO, but the output still isn't quite
-                        right.  For example, on the first South Asia
-                        line of etc/HELLO, the third example
-                        (Kannada) is missing the last glyph.  This
-                        seems to be caused by the fact that more
-                        glyphs are produced than there are characters
-                        in the output (other scripts on that line
-                        result in the same or fewer glyphs). */
-                     if (my_char < 0)
-                       from = to = rtl > 0 ? nchars_in_run - 1: 0;
+                     while (from >= 0 && from < nchars_in_run
+                            && clusters[from] < j)
+                       from += rtl;
+                     if (from < 0)
+                       from = to = 0;
+                     else if (from >= nchars_in_run)
+                       from = to = nchars_in_run - 1;
                      else
                        {
                          int k;
-                         from = my_char;
-                         to = rtl > 0 ? nchars_in_run : 0;
-                         for (k = my_char + rtl; k >= 0 && k < nchars_in_run;
+                         to = rtl > 0 ? nchars_in_run - 1 : 0;
+                         for (k = from + rtl; k >= 0 && k < nchars_in_run;
                               k += rtl)
                            {
                              if (clusters[k] > j)
                                {
-                                 to = k;
+                                 to = k - 1;
                                  break;
                                }
                            }
                        }
                    }
 
-                 if (my_char < 0 || clusters[my_char] > j)
-                   {
-                     /* No mapping.  */
-                     LGLYPH_SET_CHAR (lglyph, 0);
-                     LGLYPH_SET_FROM (lglyph, items[i].iCharPos + from);
-                     LGLYPH_SET_TO (lglyph, items[i].iCharPos + to);
-                   }
-                 else
-                   {
                      LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos
-                                                    + my_char]);
+                                                + from]);
                      LGLYPH_SET_FROM (lglyph, items[i].iCharPos + from);
                      LGLYPH_SET_TO (lglyph, items[i].iCharPos + to);
-                   }
 
                  /* Metrics.  */
                  LGLYPH_SET_WIDTH (lglyph, advances[j]);




reply via email to

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