Supports left MAGE.
authorKoichi KAMICHI <kamichi@fonts.jp>
Mon, 9 Aug 2010 10:12:32 +0000 (10:12 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Mon, 9 Aug 2010 10:12:32 +0000 (10:12 +0000)
engine/kagecd.js
engine/kagedf.js

index 2ee78b7..a6c6410 100755 (executable)
@@ -843,17 +843,33 @@ function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){
           //KAGI NO YOKO BOU NO SAIGO NO MARU\r
           poly = new Polygon();\r
           if(kage.kUseCurve){\r
-            poly.push(x2, y2 - kMinWidthT);\r
-            poly.push(x2 + kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);\r
-            poly.push(x2 + kMinWidthT, y2);\r
-            poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);\r
-            poly.push(x2, y2 + kMinWidthT);\r
+            if(x1 < x2){\r
+              poly.push(x2, y2 - kMinWidthT);\r
+              poly.push(x2 + kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);\r
+              poly.push(x2 + kMinWidthT, y2);\r
+              poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);\r
+              poly.push(x2, y2 + kMinWidthT);\r
+            } else {\r
+              poly.push(x2, y2 - kMinWidthT);\r
+              poly.push(x2 - kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);\r
+              poly.push(x2 - kMinWidthT, y2);\r
+              poly.push(x2 - kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);\r
+              poly.push(x2, y2 + kMinWidthT);\r
+            }\r
           } else {\r
-            poly.push(x2, y2 - kMinWidthT);\r
-            poly.push(x2 + kMinWidthT * 0.6, y2 - kMinWidthT * 0.6);\r
-            poly.push(x2 + kMinWidthT, y2);\r
-            poly.push(x2 + kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);\r
-            poly.push(x2, y2 + kMinWidthT);\r
+            if(x1 < x2){\r
+              poly.push(x2, y2 - kMinWidthT);\r
+              poly.push(x2 + kMinWidthT * 0.6, y2 - kMinWidthT * 0.6);\r
+              poly.push(x2 + kMinWidthT, y2);\r
+              poly.push(x2 + kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);\r
+              poly.push(x2, y2 + kMinWidthT);\r
+            } else {\r
+              poly.push(x2, y2 - kMinWidthT);\r
+              poly.push(x2 - kMinWidthT * 0.6, y2 - kMinWidthT * 0.6);\r
+              poly.push(x2 - kMinWidthT, y2);\r
+              poly.push(x2 - kMinWidthT * 0.6, y2 + kMinWidthT * 0.6);\r
+              poly.push(x2, y2 + kMinWidthT);\r
+            }\r
           }\r
           polygons.push(poly);\r
         }\r
@@ -861,10 +877,17 @@ function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){
         if(a2 == 5){\r
           //KAGI NO YOKO BOU NO HANE\r
           poly = new Polygon();\r
-          poly.push(x2, y2 - kMinWidthT + 1);\r
-          poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * 5);\r
-          poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);\r
-          poly.push(x2 - kMinWidthT, y2 - kMinWidthT + 1);\r
+          if(x1 < x2){\r
+            poly.push(x2, y2 - kMinWidthT + 1);\r
+            poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * 5);\r
+            poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);\r
+            poly.push(x2 - kMinWidthT, y2 - kMinWidthT + 1);\r
+          } else {\r
+            poly.push(x2, y2 - kMinWidthT + 1);\r
+            poly.push(x2 - 2, y2 - kMinWidthT - kage.kWidth * 5);\r
+            poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);\r
+            poly.push(x2 + kMinWidthT, y2 - kMinWidthT + 1);\r
+          }\r
           poly.reverse(); // for fill-rule\r
           polygons.push(poly);\r
         }\r
@@ -980,7 +1003,7 @@ function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){
           poly = new Polygon();\r
           if(kage.kUseCurve){\r
             poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);\r
-            poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v + Math.sin(rad) * kMinWidthT * 0.9 * v,\r
+            poly.push(x2 - Math.cos(rad) * kMinWidthT * 0.9 * v + Math.sin(rad) * kMinWidthT * 0.9 * v,\r
                       y2 + Math.sin(rad) * kMinWidthT * 0.9 * v - Math.cos(rad) * kMinWidthT * 0.9 * v, 1);\r
             poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);\r
             poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v - Math.sin(rad) * kMinWidthT * 0.9 * v,\r
@@ -1001,13 +1024,23 @@ function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){
         if(a1 == 6 && a2 == 5){\r
           //KAGI NO YOKO BOU NO HANE\r
           poly = new Polygon();\r
-          poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kMinWidthT - 1) * Math.cos(rad) * v);\r
-          poly.push(x2 + 2 * Math.cos(rad) * v + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
-                    y2 + 2 * Math.sin(rad) * v - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
-          poly.push(x2 + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
-                    y2 - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
-          poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v - kMinWidthT * Math.cos(rad) * v,\r
-                    y2 - (kMinWidthT - 1) * Math.cos(rad) * v - kMinWidthT * Math.sin(rad) * v);\r
+          if(x1 < x2){\r
+            poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v, y2 - (kMinWidthT - 1) * Math.cos(rad) * v);\r
+            poly.push(x2 + 2 * Math.cos(rad) * v + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
+                      y2 + 2 * Math.sin(rad) * v - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
+            poly.push(x2 + (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
+                      y2 - (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
+            poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v - kMinWidthT * Math.cos(rad) * v,\r
+                      y2 - (kMinWidthT - 1) * Math.cos(rad) * v - kMinWidthT * Math.sin(rad) * v);\r
+          } else {\r
+            poly.push(x2 - (kMinWidthT - 1) * Math.sin(rad) * v, y2 + (kMinWidthT - 1) * Math.cos(rad) * v);\r
+            poly.push(x2 + 2 * Math.cos(rad) * v - (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
+                      y2 + 2 * Math.sin(rad) * v + (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
+            poly.push(x2 - (kMinWidthT + kage.kWidth * 5) * Math.sin(rad) * v,\r
+                      y2 + (kMinWidthT + kage.kWidth * 5) * Math.cos(rad) * v);\r
+            poly.push(x2 + (kMinWidthT - 1) * Math.sin(rad) * v - kMinWidthT * Math.cos(rad) * v,\r
+                      y2 - (kMinWidthT - 1) * Math.cos(rad) * v - kMinWidthT * Math.sin(rad) * v);\r
+          }\r
           polygons.push(poly);\r
         }\r
         \r
index be3cde2..a6c4838 100755 (executable)
@@ -97,7 +97,7 @@ function dfDrawFont(kage, polygons, a1, a2, a3, x1, y1, x2, y2, x3, y3, x4, y4){
         \r
         cdDrawLine(kage, polygons, x1, y1, tx1, ty1, a2, 1);\r
         cdDrawCurve(kage, polygons, tx1, ty1, x2, y2, tx2, ty2, 1 + (a2 - a2 % 1000) * 10, 1);\r
-        if(tx3 - tx2 > 0){ // for closer position\r
+        if((x2 < x3 && tx3 - tx2 > 0) || (x2 > x3 && tx2 - tx3 > 0)){ // for closer position\r
           cdDrawLine(kage, polygons, tx2, ty2, tx3, ty3, 6, 5); // bolder by force\r
         }\r
       }\r