[Pkg-javascript-commits] [pdf.js] 167/207: A few small optimizations for CIDFontType2 fonts

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:44 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 c121def80696c9e4786af645fe1b45269412a94d
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Wed Jun 25 20:56:43 2014 +0200

    A few small optimizations for CIDFontType2 fonts
    
    Cache a constant length and replace one usage of |in| with a comparison against undefined.
---
 src/core/fonts.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/core/fonts.js b/src/core/fonts.js
index f86272e..64f680e 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -3888,8 +3888,9 @@ var Font = (function FontClosure() {
       }
 
       var charCodeToGlyphId = [], charCode;
-      if (properties.type == 'CIDFontType2') {
+      if (properties.type === 'CIDFontType2') {
         var cidToGidMap = properties.cidToGidMap || [];
+        var cidToGidMapLength = cidToGidMap.length;
         var cMap = properties.cMap.map;
         for (charCode in cMap) {
           charCode |= 0;
@@ -3897,9 +3898,9 @@ var Font = (function FontClosure() {
           assert(cid.length === 1, 'Max size of CID is 65,535');
           cid = cid.charCodeAt(0);
           var glyphId = -1;
-          if (cidToGidMap.length === 0) {
+          if (cidToGidMapLength === 0) {
             glyphId = charCode;
-          } else if (cid in cidToGidMap) {
+          } else if (cidToGidMap[cid] !== undefined) {
             glyphId = cidToGidMap[cid];
           }
           if (glyphId >= 0 && glyphId < numGlyphs) {

-- 
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