Subject: Re: bug#832: Compiling Emacs.app fails this afternoon. [PATCH]

From: Daniel Koning <[email-masked]>
Date: Thu, 4 Sep 2008 06:23:58 +0000 (UTC)

Gilbert Harman <harman <at> princeton.edu> writes:

> 
> After ./configure --with-ns....make -j2....nsfont.m: In function
'nsfont_char_width':nsfont.m:481: warning: 'widthOfString:' is deprecated
(declared at /System/Library/Frameworks/AppKit.framework/Headers/NSFont.h:216)
> nsfont.m: In function 'nsfont_open':nsfont.m:726: warning: 'widthOfString:' is
deprecated (declared at
/System/Library/Frameworks/AppKit.framework/Headers/NSFont.h:216)nsfont.m: In
function 'nsfont_draw':nsfont.m:907: error: 'struct glyph_string' has no member
named 'gidx'
> nsfont.m:908: error: 'struct glyph_string' has no member named
'gidx'nsfont.m:914: error: 'struct glyph_string' has no member named
'gidx'nsfont.m:1097: error: 'struct glyph_string' has no member named
'gidx'nsfont.m:1103: error: 'struct glyph_string' has no member named 'gidx'
> make[1]: *** [nsfont.o] Error 1make[1]: *** Waiting for unfinished
jobs....make: *** [src] Error 2  Gil(Intel Mac OS X 10.5.4)

This appears to have been caused by nsfont_draw() not having been updated to use
cmp_from instead of gidx.

Here's a patch, which also updates a couple of out-of-date comments:

Index: src/nsfont.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsfont.m,v
retrieving revision 1.11
diff -u -r1.11 nsfont.m
--- src/nsfont.m	21 Aug 2008 02:49:00 -0000	1.11
+++ src/nsfont.m	4 Sep 2008 06:23:03 -0000
@@ -904,14 +904,14 @@
     int hi, lo;
     char isComposite = 0; /* s->first_glyph->type == COMPOSITE_GLYPH; */
     /* FIXME: composition: no vertical displacement is considered. */
-    t+= s->gidx; /* advance into composition */
-    for (i =0; i<s->nchars - s->gidx; i++, t++)
+    t+= s->cmp_from; /* advance into composition */
+    for (i =0; i<s->nchars - s->cmp_from; i++, t++)
       {
         hi = (*t & 0xFF00) >> 8;
         lo = *t & 0x00FF;
         if (isComposite)
           {
-            cwidth = s->cmp->offsets[s->gidx++ * 2] - twidth;
+            cwidth = s->cmp->offsets[s->cmp_from++ * 2] - twidth;
           }
         else
           {
@@ -1094,13 +1094,13 @@
       [col set];
 
     CGContextSetTextPosition (gcontext, r.origin.x, r.origin.y);
-    CGContextShowGlyphsWithAdvances (gcontext, s->char2b + s->gidx,
+    CGContextShowGlyphsWithAdvances (gcontext, s->char2b + s->cmp_from,
                                     advances, len);
 
     if (face->overstrike)
       {
         CGContextSetTextPosition (gcontext, r.origin.x+0.5, r.origin.y);
-        CGContextShowGlyphsWithAdvances (gcontext, s->char2b + s->gidx,
+        CGContextShowGlyphsWithAdvances (gcontext, s->char2b + s->cmp_from,
                                         advances, len);
       }
 
Index: src/xdisp.c
===================================================================
RCS file: /sources/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1254
diff -u -r1.1254 xdisp.c
--- src/xdisp.c	31 Aug 2008 08:27:25 -0000	1.1254
+++ src/xdisp.c	4 Sep 2008 06:23:21 -0000
@@ -19532,7 +19532,7 @@
 /* Fill glyph string S with composition components specified by S->cmp.
 
    BASE_FACE is the base face of the composition.
-   S->gidx is the index of the first component for S.
+   S->cmp_from is the index of the first component for S.
 
    OVERLAPS non-zero means S should draw the foreground only, and use
    its physical height for clipping.  See also draw_glyphs.
@@ -19547,7 +19547,7 @@
 {
   int i;
   /* For all glyphs of this composition, starting at the offset
-     S->gidx, until we reach the end of the definition or encounter a
+     S->cmp_from, until we reach the end of the definition or encounter a
      glyph that requires the different face, add it to S.  */
   struct face *face;