]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Aug 2011 16:17:22 +0000 (16:17 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Aug 2011 16:17:22 +0000 (16:17 +0000)
fluidbook/tools/convert.pe
fluidbook/tools/fwstk/src/org/apache/pdfbox/util/PDFStreamEngine.java
fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowText.java [new file with mode: 0644]
fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowTextGlyph.java [new file with mode: 0644]
inc/ws/Metier/class.ws.document.php
inc/ws/Util/html5/class.ws.html5.compiler.php

index d9d30737167de38e923180f3d587ab6902bd7bef..43c65f7069146d2407806a1fc1b73f9d4e5c4904 100644 (file)
@@ -1,11 +1,29 @@
 #!/usr/local/bin/fontforge
 Open($1,1)
 Print("Open font ",$1)
-i=2;
-while ( i<=$argc-2 )
+i=2
+while ( i<=$argc-3 )
        Print ("Merge with font ",$argv[i]);
        MergeFonts($argv[i],1)
    ++i
 endloop
+
+//
+if($argv[i]!="-")
+       cmap=LoadStringFromFile()
+       glyphs=StrSplit(cmap,"\\n");
+       j=0
+       while(j<SizeOf(glyphs))
+               if(glyphs[j]!="")
+                       glyph=StrSplit(glyphs[j],"      ")
+                       u=Strtol(glyph[0],16)
+                       Select(glyph[1])
+                       SetUnicodeValue(UCodePoint(u))
+                       j++
+               endif
+       endloop
+endif
+
+i++
 Print("Write font ",$argv[i])
 Generate($argv[i])
\ No newline at end of file
index bcbdcb58b429cbc6f5058df3d02b2ed3d9ae3f6a..a9f30603ae3f54bf2970e92176779f2f6ef38739 100644 (file)
@@ -81,6 +81,7 @@ public class PDFStreamEngine {
        private Map<String, PDFont> documentFontCache = new HashMap<String, PDFont>();
        private int validCharCnt;
        private int totalCharCnt;
+       protected String currentString;
        /**
         * Flag to skip malformed or otherwise unparseable input where possible.
         */
@@ -151,6 +152,10 @@ public class PDFStreamEngine {
                totalCharCnt = 0;
        }
 
+       public void setCurrentString(String s) {
+               currentString = s;
+       }
+
        public boolean isForceParsing() {
                return forceParsing;
        }
@@ -366,6 +371,20 @@ public class PDFStreamEngine {
                                c = font.encode(string, i, codeLength);
                        }
 
+                       try {
+                               String currentChar= Character.toString(currentString.charAt(i));
+                               if (c.toUpperCase().equals(currentChar)) {
+                                       System.out.println("up");
+                                       c = c.toUpperCase();
+                               } else if (c.toLowerCase().equals(currentChar)) {
+                                       System.out.println("low");
+                                       c = c.toLowerCase();
+                               }
+                       } catch (       NullPointerException | StringIndexOutOfBoundsException e) {
+                       }
+
+                       //System.out.println(c+";"+currentString.charAt(i));
+
                        // the space width has to be transformed into display units
                        float spaceWidthDisp = spaceWidthText * fontSizeText * horizontalScalingText * textMatrix.getValue(0, 0) * ctm.getValue(0, 0);
 
diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowText.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowText.java
new file mode 100644 (file)
index 0000000..a5f7c8d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator;
+
+import java.util.List;
+
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSString;
+import org.apache.pdfbox.util.PDFOperator;
+
+import java.io.IOException;
+
+/**
+ * @author Huault : huault@free.fr
+ * @version $Revision: 1.4 $
+ */
+public class ShowText extends OperatorProcessor {
+
+       /**
+        * Tj show Show text.
+        * @param operator The operator that is being executed.
+        * @param arguments List
+        *
+        * @throws IOException If there is an error processing this operator.
+        */
+       public void process(PDFOperator operator, List<COSBase> arguments) throws IOException {
+               COSString string = (COSString) arguments.get(0);
+               context.setCurrentString(string.getString());
+               context.processEncodedText(string.getBytes());
+       }
+}
diff --git a/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowTextGlyph.java b/fluidbook/tools/fwstk/src/org/apache/pdfbox/util/operator/ShowTextGlyph.java
new file mode 100644 (file)
index 0000000..b61c6de
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.util.operator;
+
+import java.util.List;
+
+import org.apache.pdfbox.util.Matrix;
+import org.apache.pdfbox.util.PDFOperator;
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSNumber;
+import java.io.IOException;
+import org.apache.pdfbox.cos.COSString;
+
+/**
+ * @author Huault : huault@free.fr
+ * @version $Revision: 1.6 $
+ */
+public class ShowTextGlyph extends OperatorProcessor {
+
+       /**
+        * TJ Show text, allowing individual glyph positioning.
+        * @param operator The operator that is being executed.
+        * @param arguments List
+        * @throws IOException If there is an error processing this operator.
+        */
+       public void process(PDFOperator operator, List<COSBase> arguments) throws IOException {
+               COSArray array = (COSArray) arguments.get(0);
+               int arraySize = array.size();
+               float fontsize = context.getGraphicsState().getTextState().getFontSize();
+               float horizontalScaling = context.getGraphicsState().getTextState().getHorizontalScalingPercent() / 100;
+               for (int i = 0; i < arraySize; i++) {
+                       COSBase next = array.get(i);
+                       if (next instanceof COSNumber) {
+                               float adjustment = ((COSNumber) next).floatValue();
+                               Matrix adjMatrix = new Matrix();
+                               adjustment = -(adjustment / 1000) * horizontalScaling * fontsize;
+                               // TODO vertical writing mode
+                               adjMatrix.setValue(2, 0, adjustment);
+                               context.setTextMatrix(adjMatrix.multiply(context.getTextMatrix(), adjMatrix));
+                       } else if (next instanceof COSString) {
+                               context.setCurrentString(((COSString) next).getString());
+                               context.processEncodedText(((COSString) next).getBytes());
+
+                       } else {
+                               throw new IOException("Unknown type in array for TJ operation:" + next);
+                       }
+               }
+       }
+}
index b960c3fbdfce891c61813d556f892380038c11fd..7b707046a0026203033e95cfd55a054fcf8506dc 100644 (file)
@@ -156,6 +156,7 @@ class wsDocument extends cubeMetier {
                        foreach ($files as $file) {\r
                                $fontforge->setArg(null, $out . '/' . $file);\r
                        }\r
+                       $fontforge->setArg(null, $this->out . '/html/' . $fontname . '.cmap');\r
                        $fontforge->setArg(null, $this->out . '/fonts/web/' . $fontname . '.ttf');\r
                        $fontforge->execute();\r
                        $this->addToLog($fontforge);\r
index 0b89cc36682f1b5b49bf21243578899ef40958b3..a05e3455747fcfa203bdba30ce7aa5f2e6e418c3 100644 (file)
@@ -93,8 +93,8 @@ class wsHTML5Compiler {
                $firstDoc = $daoDoc->selectById($this->pages[1]['document_id']);
                $size = $firstDoc->generalInfos['size'];
 
-               $this->width = round($size[0],2);
-               $this->height = round($size[1],2);
+               $this->width = round($size[0], 2);
+               $this->height = round($size[1], 2);
        }
 
        public function virtualToPhysical($virtual) {
@@ -297,8 +297,8 @@ class wsHTML5Compiler {
                $config->numerotation = explode(',', $this->book->numerotation);
                $config->id = $this->book->book_id;
                $config->cacheDate = TIME;
-               $config->width=$this->width;
-               $config->height=$this->height;
+               $config->width = $this->width;
+               $config->height = $this->height;
                return 'var DATAS=' . json_encode($config) . ';' . "\n";
        }
 
@@ -313,8 +313,11 @@ class wsHTML5Compiler {
                                foreach ($this->fontDocs[$font] as $document_id => $dummy) {
                                        $fontforge->setArg(null, WS_DOCS . '/' . $document_id . '/fonts/web/' . $font . '.ttf');
                                }
+                               $fontforge->setArg(null, '-');
                                $fontforge->setArg(null, $this->vdir . '/data/style/F' . $index . '.' . $format);
                                $fontforge->execute();
+                               
+                               fb($fontforge->commande);
                        }
                }
        }
@@ -560,7 +563,7 @@ class wsHTML5Compiler {
                // Links Styles
                $res = array_merge($res, $links);
                $res[] = '.link a.displayArea:hover,.link a.displayArea.animating{background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}';
-               $res[]='.link a.displayArea{-webkit-tap-highlight-color:'.self::colorToCSS($this->theme->parametres->linksColor, 0.4).';}';
+               $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}';
 
                // Menus
                # View