From: vincent@cubedesigners.com Date: Sun, 14 Aug 2011 22:39:25 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=76d493dc13d3cf7f67fb731fb03cfd4cc833f2c3;p=cubeextranet.git --- diff --git a/fluidbook/tools/convert.pe b/fluidbook/tools/convert.pe index 84528222b..b960a08bd 100644 --- a/fluidbook/tools/convert.pe +++ b/fluidbook/tools/convert.pe @@ -1,13 +1,13 @@ #!/usr/local/bin/fontforge Open($1,1) - +Print("Open font ",$1) i=2; while ( i<=$argc-2 ) - if (i==1) - MergeFonts($argv[i],1) - endif + Print ("Merge with font ",$argv[i]); + MergeFonts($argv[i],1) ++i endloop RemoveAllKerns() +Print("Write font ",$argv[i]) Generate($argv[i]) \ No newline at end of file diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index fb9e444b0..97d3c1483 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -129,11 +129,11 @@ class wsDocument extends cubeMetier { if (!file_exists($this->out . '/fonts/web')) { mkdir($this->out . '/fonts/web', 0777, true); } - $formats = array('ttf', 'woff', 'svg', 'svgz', 'eot'); + $images = array('pnm', 'jpg', 'jpeg', 'png', 'pam'); // Fonts conversion $collections = array(); while ($file = readdir($dr)) { - if ($file == '.' || $file == '..') { + if ($file == '.' || $file == '..' || in_array(files::getExtension($file), $images)) { continue; } @@ -151,24 +151,15 @@ class wsDocument extends cubeMetier { $collections[$fname][] = $file; } - foreach ($collections as $fontname => $files) { - foreach ($formats as $format) { - if ($format == 'eot') { - $ttf2eot = new cubeCommandLine('ttf2eot', $this->out . '/fonts/web/' . $fontname . '.eot'); - $ttf2eot->setPath(CONVERTER_PATH); - $ttf2eot->setManualArg('< ' . $this->out . '/fonts/web/' . $fontname . '.ttf'); - $ttf2eot->execute(); - } else { - $fontforge = new cubeCommandLine('convert.pe'); - $fontforge->setPath(CONVERTER_PATH); - foreach ($files as $file) { - $fontforge->setArg(null, $out . '/' . $file); - } - $fontforge->setArg(null, $this->out . '/fonts/web/' . $fontname . '.' . $format); - $fontforge->execute(); - $this->addToLog($fontforge); - } + foreach ($collections as $fontname => $files) { + $fontforge = new cubeCommandLine('convert.pe'); + $fontforge->setPath(CONVERTER_PATH); + foreach ($files as $file) { + $fontforge->setArg(null, $out . '/' . $file); } + $fontforge->setArg(null, $this->out . '/fonts/web/' . $fontname . '.ttf'); + $fontforge->execute(); + $this->addToLog($fontforge); } } diff --git a/inc/ws/Util/packager/class.ws.packager.php b/inc/ws/Util/packager/class.ws.packager.php index 78702703e..5258b68f1 100644 --- a/inc/ws/Util/packager/class.ws.packager.php +++ b/inc/ws/Util/packager/class.ws.packager.php @@ -13,7 +13,8 @@ class wsPackager { protected $daoBook; public static function package($book_id, $version) { - cubePHP::neverStop(); + //cubePHP::neverStop(); + set_time_limit(10); if ($version == 'html') { $packager = new wsPackagerHTML($book_id); } elseif ($version == 'win-exe') { diff --git a/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php b/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php index e65d619a9..e47b0f47f 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php @@ -231,7 +231,7 @@ class videoLink extends wsPackagerHTML5Link { 'controls' => $this->video_controls == '1', 'autoPlay' => $this->video_auto_start == '1', 'loop' => $this->video_loop); - $res.=cubeMedia::flashObject('data/swf/video.swf', $w, $h, $flashvars, 'swfplayer-' . $basename, '', 9, '#ffffff', '', 'true', 'noscale', 'normal'); + $res.=cubeMedia::flashObject('swf/video.swf', $w, $h, $flashvars, 'swfplayer-' . $basename, '', 9, '#ffffff', '', 'true', 'noscale', 'normal'); $res.=''; return $res; } diff --git a/inc/ws/Util/packager/html5/class.ws.packager.html5.php b/inc/ws/Util/packager/html5/class.ws.packager.html5.php index 3f7e6052a..7a82629ec 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.php @@ -19,6 +19,7 @@ class wsPackagerHTML5 extends wsPackager { protected $numerotation; protected static $resolutions = array(36, 72, 150); protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', ''); + protected $fontDocs = array(); public function __construct($book_id) { parent::__construct($book_id); @@ -139,7 +140,7 @@ class wsPackagerHTML5 extends wsPackager { if (isset($pages[$i])) { $c = $pages[$i]; } - file_put_contents($this->vdir . '/data/links/pages/p' . $i . '.html', $c); + file_put_contents($this->vdir . 'data/links/pages/p' . $i . '.html', $c); } return $css; } @@ -153,11 +154,25 @@ class wsPackagerHTML5 extends wsPackager { } protected function writeFonts() { - $fext = array('ttf', 'eot', 'svg', 'svgz', 'woff'); + $formats = array('ttf', 'woff', 'svg', 'svgz', 'eot'); + foreach ($this->cssFont as $font => $index) { - list($font, $document_id) = explode('//', $font); - foreach ($fext as $ext) { - copy(WS_DOCS . '/' . $document_id . "/fonts/web/" . $font . '.' . $ext, $this->vdir . '/data/style/F' . $index . '.' . $ext); + + foreach ($formats as $format) { + if ($format == 'eot') { + $ttf2eot = new cubeCommandLine('ttf2eot', $this->vdir . '/data/style/F' . $index . '.' . $format); + $ttf2eot->setPath(CONVERTER_PATH); + $ttf2eot->setManualArg('< ' . $this->vdir . '/data/style/F' . $index . '.ttf'); + $ttf2eot->execute(); + } else { + $fontforge = new cubeCommandLine('convert.pe'); + $fontforge->setPath(CONVERTER_PATH); + foreach ($this->fontDocs[$font] as $document_id => $dummy) { + $fontforge->setArg(null, WS_DOCS . '/' . $document_id . '/fonts/web/' . $font . '.ttf'); + } + $fontforge->setArg(null, $this->vdir . '/data/style/F' . $index . '.' . $format); + $fontforge->execute(); + } } } } @@ -451,7 +466,6 @@ class wsPackagerHTML5 extends wsPackager { } foreach ($this->cssFont as $font => $index) { - list($font, $document_id) = explode('//', $font); $res[] = "@font-face{font-family:F" . $index . ";src:url('F" . $index . ".eot');src:url('F" . $index . ".eot?#iefix') format('eot'),url('F" . $index . ".ttf') format('truetype'),url('F" . $index . ".svgz#" . $font . "') format('svgz'),url('F" . $index . ".svg#" . $font . "') format('svg')}"; $res[] = '.f' . $index . '{font-family:F' . $index . ',Arial,Helvetica}'; } @@ -505,9 +519,6 @@ class wsPackagerHTML5 extends wsPackager { $pos+=$span['width']; $first = false; } else { - if ((string) $span == 'MARDI 19') { - fb($span['x'], $newSpan['x']); - } if ((float) $span['x'] < (float) $newSpan['x']) { // On change de groupe $ls = $ws = 0; @@ -521,7 +532,7 @@ class wsPackagerHTML5 extends wsPackager { $res[] = array( 'color' => $this->getCSSColor($group['color']), 'size' => $this->getCSSSize($group['size']), - 'font' => $this->getCSSFont($group['font'], $document_id), + 'font' => $this->getCSSFont((string)$group['font'], $document_id), 'letterspacing' => $this->getCSSLetterSpacing($ls), 'wordspacing' => $this->getCSSLetterSpacing($ws), 'y' => 0, @@ -619,7 +630,13 @@ class wsPackagerHTML5 extends wsPackager { } protected function getCSSFont($font, $document_id) { - return $this->getIndex($font . "//" . $document_id, $this->cssFont); + $font=(string) $font; + if (!isset($this->fontDocs[$font])) { + $this->fontDocs[$font] = array(); + } + $this->fontDocs[$font][$document_id] = true; + + return $this->getIndex($font, $this->cssFont); } protected function getCSSColor($color) {