]> git.parisson.com Git - pdf.js.git/commitdiff
implement TL and T*
authorChris Jones <jones.chris.g@gmail.com>
Fri, 10 Jun 2011 01:19:17 +0000 (18:19 -0700)
committerChris Jones <jones.chris.g@gmail.com>
Fri, 10 Jun 2011 01:19:17 +0000 (18:19 -0700)
pdf.js
test.html

diff --git a/pdf.js b/pdf.js
index 8f0b09e3506f994430fa19d324c26846c26b31d1..f7e553699bc82f0e97ac348fb93956da97aa1d9c 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -1547,6 +1547,7 @@ var CanvasExtraState = (function() {
         this.alphaIsShape = false;
         this.fontSize = 0.0;
         this.textMatrix = IDENTITY_MATRIX;
+        this.leading = 0.0;
         // Current point (in user coordinates)
         this.x = 0.0;
         this.y = 0.0;
@@ -1600,9 +1601,11 @@ var CanvasGraphics = (function() {
             // Text
             BT: this.beginText,
             ET: this.endText,
+            TL: this.setLeading,
             Tf: this.setFont,
             Td: this.moveText,
             Tm: this.setTextMatrix,
+            "T*": this.nextLine,
             Tj: this.showText,
             TJ: this.showSpacedText,
 
@@ -1774,6 +1777,9 @@ var CanvasGraphics = (function() {
         },
         endText: function() {
         },
+        setLeading: function(leading) {
+            this.current.leading = leading;
+        },
         setFont: function(fontRef, size) {
             var fontRes = this.res.get("Font");
             if (!fontRes)
@@ -1795,6 +1801,9 @@ var CanvasGraphics = (function() {
             this.current.x = this.current.lineX = 0;
             this.current.y = this.current.lineY = 0;
         },
+        nextLine: function() {
+            this.moveText(0, this.current.leading);
+        },
         showText: function(text) {
             this.ctx.save();
             this.ctx.translate(0, 2 * this.current.y);
index 09ccf62d2b972ef54c9c2cb65835528ac49d581d..8cb8cb8ee9234d240bd07bffa26241d7644e5233 100644 (file)
--- a/test.html
+++ b/test.html
@@ -52,7 +52,8 @@ function load() {
     pageDisplay = document.getElementById("pageNumber");
     infoDisplay = document.getElementById("info");
     pageNum = parseInt(queryParams().page) || 1;
-    open("compressed.tracemonkey-pldi-09.pdf");
+//    open("compressed.tracemonkey-pldi-09.pdf");
+    open("compressed.canvas.pdf");
 }
 
 function open(url) {