Index: Source/NSBezierPath.m
===================================================================
--- Source/NSBezierPath.m	(revision 36195)
+++ Source/NSBezierPath.m	(working copy)
@@ -1686,8 +1686,101 @@
 
   if ([aCoder allowsKeyedCoding])
     {
-      [aCoder encodeFloat: (float)_flatness forKey: @"NSFlatness"];
-      // FIXME
+      NSUInteger count, i;
+      NSMutableData *d;
+      float x,y;
+      char ctype;
+
+      [aCoder encodeFloat: [self flatness] forKey: @"NSFlatness"];
+      [aCoder encodeFloat: [self lineWidth] forKey: @"NSLineWidth"];
+      [aCoder encodeInt: [self lineCapStyle] forKey: @"NSLineCapStyle"];
+      [aCoder encodeInt: [self lineJoinStyle] forKey: @"NSLineJoinStyle"];
+      [aCoder encodeInt: [self windingRule] forKey: @"NSWindingRule"];
+      [aCoder encodeFloat: [self miterLimit] forKey: @"NSMiterLimit"];
+
+      count = [self elementCount];
+      d = [NSMutableData data];
+      for (i = 0; i < count; i++)
+        {
+          type = [self elementAtIndex: i associatedPoints: pts];
+          ctype = type; 
+          [d serializeDataAt: &ctype
+                  ofObjCType: "c"
+                     context: nil];
+
+          switch (type)
+            {
+            case NSMoveToBezierPathElement:
+            case NSLineToBezierPathElement:
+              x = pts[0].x;
+              y = pts[0].y;
+              [d serializeDataAt: &x
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &y
+                      ofObjCType: "f"
+                         context: nil];
+              break;
+            case NSCurveToBezierPathElement:
+              x = pts[0].x;
+              y = pts[0].y;
+              [d serializeDataAt: &x
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &y
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &ctype
+                      ofObjCType: "c"
+                         context: nil];
+              x = pts[1].x;
+              y = pts[1].y;
+              [d serializeDataAt: &x
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &y
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &ctype
+                      ofObjCType: "c"
+                         context: nil];
+              x = pts[2].x;
+              y = pts[2].y;
+              [d serializeDataAt: &x
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &y
+                      ofObjCType: "f"
+                         context: nil];
+              break;
+            case NSClosePathBezierPathElement:
+              x = pts[0].x;
+              y = pts[0].y;
+              [d serializeDataAt: &x
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &y
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &ctype
+                      ofObjCType: "c"
+                         context: nil];
+              x = pts[1].x;
+              y = pts[1].y;
+              [d serializeDataAt: &x
+                      ofObjCType: "f"
+                         context: nil];
+              [d serializeDataAt: &y
+                      ofObjCType: "f"
+                         context: nil];
+              break;
+            default:
+              break;
+            }
+        }
+      [aCoder encodeBytes: [d bytes]
+                   length: [d length]
+                   forKey: @"NSSegments"];
     }
   else
     {
@@ -1741,6 +1834,7 @@
   if ([aCoder allowsKeyedCoding])
     {
       float f;
+      int i;
 
       if ([aCoder containsValueForKey: @"NSFlatness"])
         {
@@ -1752,6 +1846,27 @@
           f = [aCoder decodeFloatForKey: @"NSLineWidth"];
           [self setLineWidth: f];
         }
+      if ([aCoder containsValueForKey: @"NSLineCapStyle"])
+        {
+          i = [aCoder decodeIntForKey: @"NSLineCapStyle"];
+          [self setLineCapStyle: i];
+        }
+      if ([aCoder containsValueForKey: @"NSLineJoinStyle"])
+        {
+          i = [aCoder decodeIntForKey: @"NSLineJoinStyle"];
+          [self setLineJoinStyle: i];
+        }
+      if ([aCoder containsValueForKey: @"NSWindingRule"])
+        {
+          i = [aCoder decodeIntForKey: @"NSWindingRule"];
+          [self setWindingRule: i];
+        }
+      if ([aCoder containsValueForKey: @"NSMiterLimit"])
+        {
+          f = [aCoder decodeFloatForKey: @"NSMiterLimit"];
+          [self setMiterLimit: f];
+        }
+
       if ([aCoder containsValueForKey: @"NSSegments"])
         {
 	  NSUInteger length;
@@ -1870,6 +1985,7 @@
                   [self closePath];
                   break;
                 default:
+                  //NSLog(@"Unable to decode unknown bezier path element type %d", c);
                   break;
                 }
             }
