\r
public function makeHTML5Files($page) {\r
// Then make HD background shots\r
- $resolutions = array(36 => 80, 72 => 70, 150 => 50);\r
+ $resolutions = array(36 => 90, 72 => 80, 150 => 75);\r
foreach ($resolutions as $r => $q) {\r
$texts = false;\r
$this->makeShotPNM($page, 'html/h' . $r . '-', $r, $q, 4, null, $texts);\r
}\r
+ // Then get layout infos from swf\r
+ file_put_contents($this->out . '/html/s' . $page . '.layout', $this->dumpSWF($page));\r
}\r
\r
protected function checkObjectsNumber($file, $maxObjects, $page) {\r
$pdf2swf->setArg('set jpegquality', $quality);\r
$pdf2swf->setArg('set disablelinks');\r
$pdf2swf->setArg('set dots');\r
- // $pdf2swf->setManualArg('-vvv');\r
+ $pdf2swf->setManualArg('-vvv');\r
$pdf2swf->setArg(null, $this->cropped);\r
$pdf2swf->setArg('output', $this->out . $prefix . '%.swf');\r
$pdf2swf->execute();\r
$this->cssWidth = $this->width * $this->cssScale;
$this->cssHeight = $this->height * $this->cssScale;
- $this->scale = 4;
+ $this->scale = 10;
$this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssScale;
$this->numerotation = explode(',', $this->book->numerotation);
}
$fontforge->setArg(null, '-');
$fontforge->setArg(null, $this->vdir . '/data/style/F' . $index . '.' . $format);
$fontforge->execute();
-
- fb($fontforge->commande);
}
}
}
$wm = ($this->width * $this->multiply) . 'px';
$hm = ($this->height * $this->multiply) . 'px';
$offsetLeft = round(($this->optimalWidth - $this->cssWidth) / 2, 2);
+ $offsetLeft2 = $offsetLeft * 2;
$offsetTop = round(($this->optimalHeight - $this->cssHeight) / 2, 2);
$navTop = ($this->cssHeight - 40 - 100) / 2;
$res[] = '#fluidbook{left:' . $offsetLeft . 'px;top:' . $offsetTop . 'px;}';
+ $res[] = '.landscape #fluidbook{left:' . $offsetLeft2 . 'px;}';
$res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';
$res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}';
foreach (self::$resolutions as $r) {
$body.='background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');';
$body.='background-position:';
- if(file_exists($this->themeRoot . '/' . $this->theme->parametres->backgroundImage)){
- $dim=getimagesize($this->themeRoot . '/' . $this->theme->parametres->backgroundImage);
- $this->additionalConfig['backgroundRatio']=$dim[0]/$dim[1];
- }else{
- $this->additionalConfig['backgroundRatio']=1;
+ if (file_exists($this->themeRoot . '/' . $this->theme->parametres->backgroundImage)) {
+ $dim = getimagesize($this->themeRoot . '/' . $this->theme->parametres->backgroundImage);
+ $this->additionalConfig['backgroundRatio'] = $dim[0] / $dim[1];
+ } else {
+ $this->additionalConfig['backgroundRatio'] = 1;
}
switch ($this->theme->parametres->backgroundVAlign) {
protected function addLine($line, $document_id) {
$res = array();
+ if (count($line->a) > 1) {
+ $line = $this->sortLine($line);
+ }
foreach ($line->a as $group) {
$res = array_merge($res, $this->addGroup($group, $document_id));
}
"groups" => $res);
}
+ protected function sortLine($line) {
+ $debug = rand(1, 20) == 5;
+
+
+ // Copy the current line to a new one
+ $l = simplexml_load_string('<l />');
+ foreach ($line->attributes() as $k => $v) {
+ $l->addAttribute($k, $v);
+ }
+
+ // Get the s elements and sort them by x
+ $tab = array();
+ $allSpans = $line->xpath("a/s");
+ foreach ($allSpans as $span) {
+ $tab[] = $span;
+ }
+
+ usort($tab, array('wsHTML5Compiler', 'sortSpans'));
+ if ($debug) {
+ //fb($tab);
+ }
+
+ $currentGroup = null;
+ $lastParent = null;
+ foreach ($tab as $span) {
+ $parents = $span->xpath("..");
+ $parent = array_pop($parents);
+ if ($parent == $lastParent) {
+ cubeXML::append($currentGroup, $span);
+ continue;
+ }
+ if (!is_null($currentGroup)) {
+ cubeXML::append($l, $currentGroup);
+ }
+
+ $lastParent = $parent;
+ $currentGroup = simplexml_load_string('<a />');
+ foreach ($parent->attributes() as $k => $v) {
+ $currentGroup->addAttribute($k, $v);
+ }
+ cubeXML::append($currentGroup, $span);
+ }
+
+ if (!is_null($currentGroup)) {
+ cubeXML::append($l, $currentGroup);
+ }
+
+ if ($debug) {
+ fb($l);
+ }
+ return $l;
+ }
+
+ protected static function sortSpans($a, $b) {
+ $xa = floatval((string) $a['x']);
+ $xb = floatval((string) $b['x']);
+
+ if ($xa > $xb) {
+ return 1;
+ } else if ($xa < $xb) {
+ return -1;
+ }
+ return 0;
+ }
+
protected function addGroup($group, $document_id) {
$alpha = intval(substr($group['color'], 1, 2), 16);
if ($alpha == 0) {