[Sie-announce] SIEコード [1811]

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 5月 1日 (土) 23:06:18 JST


Revision: 1811
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1811
Author:   dhrname
Date:     2010-05-01 23:06:17 +0900 (Sat, 01 May 2010)

Log Message:
-----------


Modified Paths:
--------------
    branches/ufltima/dom/svg.js

Modified: branches/ufltima/dom/svg.js
===================================================================
--- branches/ufltima/dom/svg.js	2010-04-30 14:33:45 UTC (rev 1810)
+++ branches/ufltima/dom/svg.js	2010-05-01 14:06:17 UTC (rev 1811)
@@ -2631,8 +2631,14 @@
         //Textノードにdiv要素を格納したリストをプロパティとして蓄えておく
         tar._tar = [];
         for (var i=0, tdli=tar.data.length;i<tdli;++i) {
-          var d = document.createElement("div");
-          d.style.position = "absolute";
+          var d = document.createElement("div"), dstyle = d.style;
+          dstyle.position = "absolute";
+          dstyle.marginLeft = "0px";
+          dstyle.marginTop = "0px";
+          dstyle.paddingTop = "0px";
+          dstyle.paddingLeft = "0px";
+          dstyle.textIndent = "0px";
+          dstyle.whiteSpace = "nowrap";
           d.appendChild(document.createTextNode(tar.data.charAt(i)));
           tar._tar[tar._tar.length] = d;
         }
@@ -2657,7 +2663,8 @@
       } else {
         var ptx = pty = ptdx = ptdy = {numberOfItems : 0};
       }
-      var kern = "fijlt.,:;1";
+      var kern = "fijlt.,:;1'", akern = "abcdghkmnopqsuvwxyz", alm = 0;
+;
       while (ti) {
         if (ti.nodeType === Node.TEXT_NODE) {
           var tt = ti._tar;
@@ -2682,19 +2689,28 @@
             } else if (n < tdy.numberOfItems) {
               y += tdy.getItem(n).value;
             }
-            var alm = 0;
             if (isYokogaki) {
-              if (kern.indexOf(ti.data.charAt(i))) { //カーニングを求める
-                alm = fontSize/2;
+              if (kern.indexOf(ti.data.charAt(i)) > -1) { //カーニングを求める
+                if (alm === 0) {
+                  alm = fontSize/2;
+                } else {
+                  alm = 0;
+                }
+                x -= alm;
+              } else if(akern.indexOf(ti.data.charAt(i)) > -1){
+                if (alm === 0) {
+                  x = x - fontSize/2;
+                }
+                alm = 0;
               }
               x += fontSize;
-              x -= alm;
             } else {
               y += fontSize;
             }
             tar._list[tar._list.length] = x;
             tar._list[tar._list.length] = y;
             tar._list[tar._list.length] = fontSize - alm;
+            x -= alm;
             ++n;
           }
         } else if ((ti.localName === "tspan") && (ti.namespaceURI === "http://www.w3.org/2000/svg") && ti.firtChild) {




Sie-announce メーリングリストの案内
Back to archive index