]> git.parisson.com Git - pdf.js.git/commitdiff
Handle division in hsbw to provide the correct information to the hmtx table
authorVivien Nicolas <21@vingtetun.org>
Tue, 28 Jun 2011 11:34:39 +0000 (13:34 +0200)
committerVivien Nicolas <21@vingtetun.org>
Tue, 28 Jun 2011 11:34:39 +0000 (13:34 +0200)
fonts.js

index 37b8dbccefdf4c5a26c2b01cd9fdf89b05ddb230..ecc21d9c0b56965a81788d6e1eb06c2e694417c6 100644 (file)
--- a/fonts.js
+++ b/fonts.js
@@ -1045,7 +1045,14 @@ var Type1Parser = function() {
         } else {
           // TODO Clean this code
           if (value == 13) {
-            width = charstring[1];
+            if (charstring.length == 2) {
+              width = charstring[1];
+            } else if (charstring.length == 4 && charstring[3] == "div") {
+              width = charstring[1] / charstring[2];
+            } else {
+              error("Unsupported hsbw format: " + charstring);
+            }
+
             lsb = charstring[0];
             charstring.push(lsb, "hmoveto");
             charstring.splice(0, 1);