From: vincent@cubedesigners.com Date: Sun, 8 May 2011 15:14:43 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f5da41a7cfb11bd0b9e813f8c24102c66e6637ba;p=cubeextranet.git --- diff --git a/fluidbook/tools/fwstk.jar b/fluidbook/tools/fwstk.jar index 680139494..0fe43bfad 100644 Binary files a/fluidbook/tools/fwstk.jar and b/fluidbook/tools/fwstk.jar differ diff --git a/inc/ws/Util/packager/class.ws.packager.html5.php b/inc/ws/Util/packager/class.ws.packager.html5.php index 3a5ae527e..799cc8b71 100644 --- a/inc/ws/Util/packager/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/class.ws.packager.html5.php @@ -104,7 +104,7 @@ class wsPackagerHTML5 extends wsPackager { $left = round($line['x'] * $this->multiply, 2); $top = round($line['y'] * $this->multiply, 2); - $res = '
'; + $res = '
'; foreach ($line['groups'] as $group) { $res.=$this->writeGroup($group); } @@ -127,17 +127,11 @@ class wsPackagerHTML5 extends wsPackager { if (!is_null($group['font'])) { $class[] = 'f' . $group['font']; } - if (!is_null($group['wordSpacing'])) { - $class[] = 'w' . $group['wordSpacing']; - } - if (!is_null($group['letterSpacing'])) { - $class[] = 'l' . $group['letterSpacing']; - } $class = implode(' ', $class); $top = round($group['x'] * $this->multiply, 2); - $res = '
'; + $res = '
'; foreach ($group['spans'] as $span) { $res.=$this->writeSpan($span); } @@ -149,10 +143,21 @@ class wsPackagerHTML5 extends wsPackager { if ($span === false) { return ''; } + + $class = array(); + + if (!is_null($span['letterspacing'])) { + $class[] = 'l' . $span['letterspacing']; + } + + if (count($class)) { + $class = ' class="' . implode(' ', $class) . '"'; + } + $left = round($span['x'] * $this->multiply, 2); - $res = ''; - $res .= str_replace(' ', ' ', $span['text']); + $res = ''; + $res .= self::escapeHTML($span['text']); $res .= ''; return $res; } @@ -219,16 +224,22 @@ class wsPackagerHTML5 extends wsPackager { } $res = array(); + foreach ($group->s as $span) { - $res[] = $this->addSpan($span, $document_id); + $newSpan = $this->addSpan($span, $document_id); + if (count($res) > 0) { + $lastSpan = array_pop($res); + $lastSpan['letterspacing'] = $this->getCSSLetterSpacing($newSpan['x'] - $lastSpan['x'] - $lastSpan['width']); + array_push($res, $lastspan); + } + array_push($res, $newSpan); } + return array( 'color' => $this->getCSSColor($group['color']), 'size' => $this->getCSSSize($group['size']), 'font' => $this->getCSSFont($group['font'], $document_id), - 'letterSpacing' => $this->getCSSLetterSpacing($group['letterspacing']), - 'wordSpacing' => $this->getCSSWordSpacing($group['wordspacing']), - 'x' => $group['size']/-1.2, + 'x' => $group['size'] / -1.2, 'spans' => $res); } @@ -239,7 +250,9 @@ class wsPackagerHTML5 extends wsPackager { return false; } return array('text' => $text, - 'x' => $this->normalizeFloatValue($span['x'])); + 'x' => $this->normalizeFloatValue($span['x']), + 'width' => $this->normalizeFloatValue($span['width']), + 'letterspacing' => 0); } protected function getCSSSize(&$size) { @@ -265,16 +278,15 @@ class wsPackagerHTML5 extends wsPackager { } protected function getCSSLetterSpacing($letterspacing) { - $letterspacing = $this->normalizeFloatValue($letterspacing, 2); + $letterspacing = $this->normalizeFloatValue($letterspacing, 5); if ($letterspacing == 0) { return null; } - return $this->getIndex($letterspacing, $this->cssLetterSpacing); } protected function getCSSWordSpacing($wordspacing) { - $wordspacing = $this->normalizeFloatValue($wordspacing, 2); + $wordspacing = $this->normalizeFloatValue($wordspacing, 5); if ($wordspacing == 0) { return null; } @@ -318,6 +330,14 @@ class wsPackagerHTML5 extends wsPackager { return $str; } + public static function escapeHTML($in) { + $in = str_replace(' ', ' ', $in); + $in = str_replace("\x2009", " ", $in); + + + return $in; + } + public function __destruct() { }