]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5871 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Apr 2023 13:18:41 +0000 (15:18 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Apr 2023 13:18:41 +0000 (15:18 +0200)
app/Jobs/FluidbookCompiler.php
resources/tools/fonts/convert.pe [new file with mode: 0644]
resources/tools/fonts/descriptors.pe [new file with mode: 0644]

index f43b1498fb90d180db65d6ea7adc8454e3dcdc2b..0460015039dcb6ab4e772c28d26d05ffc775c7de 100644 (file)
@@ -2413,12 +2413,15 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
                 continue;
             }
 
+
+
             $linksToAdd = [$link];
             if ($link->overlapDoublePage() && !$this->isOnePage()) {
                 $linksToAdd[] = $link->getRightClone();
             }
 
 
+
             foreach ($linksToAdd as $lta) {
                 try {
                     /** @var $lta Link */
@@ -4085,4 +4088,12 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
     {
         return $this->getFluidbook()->getPDFSplitSource($page);
     }
+
+    public function getWidthForLinks() {
+        return $this->getWidth() / $this->getLinkScale();
+    }
+
+    public function getHeightForLinks() {
+        return $this->getHeight() / $this->getLinkScale();
+    }
 }
diff --git a/resources/tools/fonts/convert.pe b/resources/tools/fonts/convert.pe
new file mode 100644 (file)
index 0000000..e8e2489
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/bin/fontforge -script
+Open($1)
+Print("Open font ",$1)
+Print("Em size : ",$em);
+i=2
+while ( i<=$argc-3 )
+       Print ("Merge with font ",$argv[i])
+       MergeFonts($argv[i])
+   ++i
+endloop
+
+if($argv[i]!="-")
+       if($iscid==1)
+               Print("It's a CID Font")
+               Print("Flatten CID")
+               CIDFlatten()
+       endif
+
+       Print("Rewrite font with CMAP ",$argv[i]);
+       cmap=LoadStringFromFile($argv[i])
+       glyphs=StrSplit(cmap,"\\n");
+       j=0
+       while(j<SizeOf(glyphs))
+               if(glyphs[j]!="")
+                       SelectNone()
+                       glyph=StrSplit(glyphs[j],"      ")
+                       ufrom=Strtol(glyph[0],16)
+                       uto=Strtol(glyph[1],16)
+                       Select(ufrom)
+                       SetUnicodeValue(UCodePoint(uto))
+                       Print("Move ",glyph[0]," to ",glyph[1])
+                       j++
+               endif
+       endloop
+
+       if(j==0)
+               Print("Empty cmap")
+               Print("Map non-display values to private area")
+
+               k=1
+
+               Reencode("unicode",1);
+
+               while(k<=32)
+                       SelectNone()
+                       Select(k)
+                       CopyReference()
+                       Select(k+57344)
+                       Paste()
+                       k++
+               endloop
+       endif
+endif
+i++
+Print("Write font ",$argv[i])
+Generate($argv[i])
diff --git a/resources/tools/fonts/descriptors.pe b/resources/tools/fonts/descriptors.pe
new file mode 100644 (file)
index 0000000..f5db504
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/fontforge -script
+Open($1)
+Print("Open font ",$1)
+
+
+if($2!="-")
+       // Italic
+       Print("Set italic angle from ",$italicangle," to ",$2)
+       SetItalicAngle(Strtol($2))
+endif
+
+if($5!="-" && $6!="-")
+       // Select first char
+       c=Strtol($5)
+       Select(c)
+       w=Real(GlyphInfo("Width"))
+       if(c==0 && Round(w)==1000)
+               Print("Maybe an error, no scaling will occur")
+       else
+               rw=Real(Strtol($6))
+               Print("First char width is ",w," and should be ",rw)
+               if(w!=rw)
+                       ratio=(rw/w)*100.0
+                       Print("Scaling the whole font to ",ratio,"%")
+                       SelectAll()
+                       Transform(Round(ratio),0,0,Round(ratio),0,0)
+               endif
+       endif
+endif
+
+
+if($3!="-" && $4!="-" && $3!="0")
+       Print("Set Ascent & Descent to ",$3," and ",$4)
+       // Ascent & Descent
+       ScaleToEm(Strtol($3),Strtol($4));
+       SetOS2Value("TypoAscent",Strtol($3));
+       SetOS2Value("TypoAscentIsOffset",0);
+       SetOS2Value("WinAscent",Strtol($3));
+       SetOS2Value("WinAscentIsOffset",0);
+       SetOS2Value("TypoDescent",Strtol($4));
+       SetOS2Value("TypoDescentIsOffset",0);
+       SetOS2Value("WinDescent",Strtol($4));
+       SetOS2Value("WinDescentIsOffset",0);
+endif
+
+SetMacStyle(-1);
+SetGasp(65535,3)
+
+Generate($1)