Improved head shpae of R2LD harai.
authorKoichi KAMICHI <kamichi@fonts.jp>
Mon, 23 Feb 2009 05:20:34 +0000 (05:20 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Mon, 23 Feb 2009 05:20:34 +0000 (05:20 +0000)
engine/kagecd.js

index 2fb134f..7d70e96 100755 (executable)
@@ -200,20 +200,33 @@ function cdDrawCurveU(kage, polygons, x1, y1, sx1, sy1, sx2, sy2, x2, y2, a1, a2
       }\r
     }\r
     \r
+    var type;\r
+    var pm = 0;\r
     if(a1 == 0){\r
       if(y1 <= y2){ //from up to bottom\r
+        type = (Math.atan2(Math.abs(y1 - sy1), Math.abs(x1 - sx1)) / Math.PI * 2 - 0.4);\r
+        if(type > 0){\r
+          type = type * 2;\r
+        } else {\r
+          type = type * 16;\r
+        }\r
+        if(type < 0){\r
+          pm = -1;\r
+        } else {\r
+          pm = 1;\r
+        }\r
         if(x1 == sx1){\r
           poly = new Polygon();\r
           poly.push(x1 - kage.kMinWidthT, y1);\r
           poly.push(x1 + kage.kMinWidthT, y1);\r
-          poly.push(x1 - kage.kMinWidthT, y1 - kage.kMinWidthY);\r
+          poly.push(x1 - kage.kMinWidthT * pm, y1 - kage.kMinWidthY * type * pm);\r
           polygons.push(poly);\r
         }\r
         else{\r
           poly = new Polygon();\r
           poly.push(x1 - kage.kMinWidthT * XX, y1 - kage.kMinWidthT * XY);\r
           poly.push(x1 + kage.kMinWidthT * XX, y1 + kage.kMinWidthT * XY);\r
-          poly.push(x1 - kage.kMinWidthT * XX - kage.kMinWidthY * YX, y1 - kage.kMinWidthT * XY - kage.kMinWidthY * YY);\r
+          poly.push(x1 - kage.kMinWidthT * pm * XX - kage.kMinWidthY * type * pm * YX, y1 - kage.kMinWidthT * pm * XY - kage.kMinWidthY * type * pm * YY);\r
           polygons.push(poly);\r
         }\r
       }\r
@@ -247,21 +260,25 @@ function cdDrawCurveU(kage, polygons, x1, y1, sx1, sy1, sx2, sy2, x2, y2, a1, a2
     \r
     if(a1 == 0){ //beginning of the stroke\r
       if(y1 <= y2){ //from up to bottom\r
+        if(pm > 0){\r
+          type = 0;\r
+        }\r
+        var move = kage.kMinWidthY * type * pm;\r
         if(x1 == sx1){\r
           poly = new Polygon();\r
-          poly.push(x1 + kage.kMinWidthT, y1);\r
-          poly.push(x1 + kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY);\r
-          poly.push(x1 + kage.kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3);\r
+          poly.push(x1 + kage.kMinWidthT, y1 - move);\r
+          poly.push(x1 + kage.kMinWidthT * 1.5, y1 + kage.kMinWidthY - move);\r
+          poly.push(x1 + kage.kMinWidthT * 0.5, y1 + kage.kMinWidthY * 3 - move / 2);\r
           polygons.push(poly);\r
         }\r
         else{\r
           poly = new Polygon();\r
-          poly.push(x1 + kage.kMinWidthT * XX,\r
-                    y1 + kage.kMinWidthT * XY);\r
-          poly.push(x1 + kage.kMinWidthT * 1.5 * XX + kage.kMinWidthY * YX,\r
-                    y1 + kage.kMinWidthT * 1.5 * XY + kage.kMinWidthY * YY);\r
-          poly.push(x1 + kage.kMinWidthT * 0.5 * XX + kage.kMinWidthY * 3 * YX,\r
-                    y1 + kage.kMinWidthT * 0.5 * XY + kage.kMinWidthY * 3 * YY);\r
+          poly.push(x1 + kage.kMinWidthT * XX - move * YX,\r
+                    y1 + kage.kMinWidthT * XY - move * YY);\r
+          poly.push(x1 + kage.kMinWidthT * 1.5 * XX + (kage.kMinWidthY - move * 1.2) * YX,\r
+                    y1 + kage.kMinWidthT * 1.5 * XY + (kage.kMinWidthY - move * 1.2) * YY);\r
+          poly.push(x1 + kage.kMinWidthT * 0.5 * XX + (kage.kMinWidthY * 3 - move * 0.8) * YX,\r
+                    y1 + kage.kMinWidthT * 0.5 * XY + (kage.kMinWidthY * 3 - move * 0.8) * YY);\r
           polygons.push(poly);\r
         }\r
       }\r
@@ -330,7 +347,7 @@ function cdDrawCurveU(kage, polygons, x1, y1, sx1, sy1, sx2, sy2, x2, y2, a1, a2
       } else {\r
         type = type * 3;\r
       }\r
-      var pm;\r
+      var pm = 0;\r
       if(type < 0){\r
         pm = -1;\r
       } else {\r