[Pkg-javascript-commits] [pdf.js] 02/106: extract more accurate glpyh heights from type-3 fonts

David Prévot taffit at moszumanska.debian.org
Sat Jun 20 21:33:21 UTC 2015


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

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

commit a5159a7942c920c17057c754fb19de3c39ec7435
Author: Levi Melamed <levimelamed at gmail.com>
Date:   Fri Apr 3 08:49:06 2015 -0500

    extract more accurate glpyh heights from type-3 fonts
---
 src/core/evaluator.js | 12 ++++++++++++
 src/core/fonts.js     |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 418ef0d..abe8fe3 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -956,6 +956,17 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
           var tsm = [textState.fontSize * textState.textHScale, 0,
                      0, textState.fontSize,
                      0, textState.textRise];
+
+          if (font.isType3Font &&
+              textState.fontMatrix !== FONT_IDENTITY_MATRIX &&
+              textState.fontSize === 1) {
+            var glyphHeight = font.bbox[3] - font.bbox[1];
+            if (glyphHeight > 0) {
+              glyphHeight = glyphHeight * textState.fontMatrix[3];
+              tsm[3] *= glyphHeight;
+            }
+          }
+
           var trm = textChunk.transform = Util.transform(textState.ctm,
                                     Util.transform(textState.textMatrix, tsm));
           if (!font.vertical) {
@@ -1615,6 +1626,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
           // is a tagged pdf. Create a barbebones one to get by.
           descriptor = new Dict(null);
           descriptor.set('FontName', Name.get(type));
+          descriptor.set('FontBBox', dict.get('FontBBox'));
         } else {
           // Before PDF 1.5 if the font was one of the base 14 fonts, having a
           // FontDescriptor was not required.
diff --git a/src/core/fonts.js b/src/core/fonts.js
index a2efa65..e2a7740 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -2438,6 +2438,7 @@ var Font = (function FontClosure() {
     this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
     this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
     this.fontMatrix = properties.fontMatrix;
+    this.bbox = properties.bbox;
 
     this.toUnicode = properties.toUnicode = this.buildToUnicode(properties);
 

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