]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sun, 8 May 2011 15:14:43 +0000 (15:14 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sun, 8 May 2011 15:14:43 +0000 (15:14 +0000)
fluidbook/tools/fwstk.jar
inc/ws/Util/packager/class.ws.packager.html5.php

index 6801394948f6208518ff7b3653fd1632e70ee399..0fe43bfaddc11d622bc166230d13d5c658b5312c 100644 (file)
Binary files a/fluidbook/tools/fwstk.jar and b/fluidbook/tools/fwstk.jar differ
index 3a5ae527edcb5de8f4fa565cc025caa1b7da19ec..799cc8b717e5edae83974d6d97b5878deb3d0232 100644 (file)
@@ -104,7 +104,7 @@ class wsPackagerHTML5 extends wsPackager {
                $left = round($line['x'] * $this->multiply, 2);\r
                $top = round($line['y'] * $this->multiply, 2);\r
 \r
-               $res = '<div style="top:' . $top . 'px;left:' . $left . 'px;" class="' . $class . '">';\r
+               $res = '<div style="top:' . $top . 'px;left:' . $left . 'px" class="' . $class . '">';\r
                foreach ($line['groups'] as $group) {\r
                        $res.=$this->writeGroup($group);\r
                }\r
@@ -127,17 +127,11 @@ class wsPackagerHTML5 extends wsPackager {
                if (!is_null($group['font'])) {\r
                        $class[] = 'f' . $group['font'];\r
                }\r
-               if (!is_null($group['wordSpacing'])) {\r
-                       $class[] = 'w' . $group['wordSpacing'];\r
-               }\r
-               if (!is_null($group['letterSpacing'])) {\r
-                       $class[] = 'l' . $group['letterSpacing'];\r
-               }\r
                $class = implode(' ', $class);\r
 \r
                $top = round($group['x'] * $this->multiply, 2);\r
 \r
-               $res = '<div class="' . $class . '" style="top:' . $top . 'px;">';\r
+               $res = '<div class="' . $class . '" style="top:' . $top . 'px">';\r
                foreach ($group['spans'] as $span) {\r
                        $res.=$this->writeSpan($span);\r
                }\r
@@ -149,10 +143,21 @@ class wsPackagerHTML5 extends wsPackager {
                if ($span === false) {\r
                        return '';\r
                }\r
+\r
+               $class = array();\r
+\r
+               if (!is_null($span['letterspacing'])) {\r
+                       $class[] = 'l' . $span['letterspacing'];\r
+               }\r
+\r
+               if (count($class)) {\r
+                       $class = ' class="' . implode(' ', $class) . '"';\r
+               }\r
+\r
                $left = round($span['x'] * $this->multiply, 2);\r
 \r
-               $res = '<span style="left:' . $left . 'px;">';\r
-               $res .= str_replace(' ', '&nbsp;', $span['text']);\r
+               $res = '<span style="left:' . $left . 'px"' . $class . '>';\r
+               $res .= self::escapeHTML($span['text']);\r
                $res .= '</span>';\r
                return $res;\r
        }\r
@@ -219,16 +224,22 @@ class wsPackagerHTML5 extends wsPackager {
                }\r
 \r
                $res = array();\r
+\r
                foreach ($group->s as $span) {\r
-                       $res[] = $this->addSpan($span, $document_id);\r
+                       $newSpan = $this->addSpan($span, $document_id);\r
+                       if (count($res) > 0) {\r
+                               $lastSpan = array_pop($res);\r
+                               $lastSpan['letterspacing'] = $this->getCSSLetterSpacing($newSpan['x'] - $lastSpan['x'] - $lastSpan['width']);\r
+                               array_push($res, $lastspan);\r
+                       }\r
+                       array_push($res, $newSpan);\r
                }\r
+\r
                return array(\r
                        'color' => $this->getCSSColor($group['color']),\r
                        'size' => $this->getCSSSize($group['size']),\r
                        'font' => $this->getCSSFont($group['font'], $document_id),\r
-                       'letterSpacing' => $this->getCSSLetterSpacing($group['letterspacing']),\r
-                       'wordSpacing' => $this->getCSSWordSpacing($group['wordspacing']),\r
-                       'x' => $group['size']/-1.2,\r
+                       'x' => $group['size'] / -1.2,\r
                        'spans' => $res);\r
        }\r
 \r
@@ -239,7 +250,9 @@ class wsPackagerHTML5 extends wsPackager {
                        return false;\r
                }\r
                return array('text' => $text,\r
-                       'x' => $this->normalizeFloatValue($span['x']));\r
+                       'x' => $this->normalizeFloatValue($span['x']),\r
+                       'width' => $this->normalizeFloatValue($span['width']),\r
+                       'letterspacing' => 0);\r
        }\r
 \r
        protected function getCSSSize(&$size) {\r
@@ -265,16 +278,15 @@ class wsPackagerHTML5 extends wsPackager {
        }\r
 \r
        protected function getCSSLetterSpacing($letterspacing) {\r
-               $letterspacing = $this->normalizeFloatValue($letterspacing, 2);\r
+               $letterspacing = $this->normalizeFloatValue($letterspacing, 5);\r
                if ($letterspacing == 0) {\r
                        return null;\r
                }\r
-\r
                return $this->getIndex($letterspacing, $this->cssLetterSpacing);\r
        }\r
 \r
        protected function getCSSWordSpacing($wordspacing) {\r
-               $wordspacing = $this->normalizeFloatValue($wordspacing, 2);\r
+               $wordspacing = $this->normalizeFloatValue($wordspacing, 5);\r
                if ($wordspacing == 0) {\r
                        return null;\r
                }\r
@@ -318,6 +330,14 @@ class wsPackagerHTML5 extends wsPackager {
                return $str;\r
        }\r
 \r
+       public static function escapeHTML($in) {\r
+               $in = str_replace(' ', '&nbsp;', $in);\r
+               $in = str_replace("\x2009", "&nbsp;", $in);\r
+\r
+\r
+               return $in;\r
+       }\r
+\r
        public function __destruct() {\r
                \r
        }\r