[Pkg-javascript-commits] [pdf.js] 113/141: Fixes number of glyphs in the generated font

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 22:40:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 65fa25ca36a0bd0dc18e2f5f62e100fb70aa6159
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Sat Apr 12 13:25:13 2014 -0500

    Fixes number of glyphs in the generated font
---
 src/core/fonts.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/core/fonts.js b/src/core/fonts.js
index 8056dc7..de0129d 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -4158,17 +4158,17 @@ var Font = (function FontClosure() {
             '\x00\x00' + // -reserved-
             '\x00\x00' + // -reserved-
             '\x00\x00' + // metricDataFormat
-            string16(numGlyphs + 1)); // Number of HMetrics
+            string16(numGlyphs)); // Number of HMetrics
         })(),
 
         // Horizontal metrics
         'hmtx': (function fontFieldsHmtx() {
           var charstrings = font.charstrings;
           var hmtx = '\x00\x00\x00\x00'; // Fake .notdef
-          for (var i = 0, ii = numGlyphs; i < ii; i++) {
+          for (var i = 1, ii = numGlyphs; i < ii; i++) {
             // TODO: For CFF fonts the width should technically match th x in
             // the glyph, but it doesn't seem to matter.
-            var charstring = charstrings ? charstrings[i] : {};
+            var charstring = charstrings ? charstrings[i - 1] : {};
             var width = 'width' in charstring ? charstring.width : 0;
             hmtx += string16(width) + string16(0);
           }
@@ -4179,7 +4179,7 @@ var Font = (function FontClosure() {
         'maxp': (function fontFieldsMaxp() {
           return stringToArray(
             '\x00\x00\x50\x00' + // Version number
-            string16(numGlyphs + 1)); // Num of glyphs
+            string16(numGlyphs)); // Num of glyphs
         })(),
 
         // Naming tables
@@ -5296,7 +5296,7 @@ var Type1Font = function Type1Font(name, file, properties) {
 
 Type1Font.prototype = {
   get numGlyphs() {
-    return this.charstrings.length;
+    return this.charstrings.length + 1;
   },
 
   getCharset: function Type1Font_getCharset() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list