From 3ea81bf0a6b2d8643c7416cab2bd4be28bb909c7 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Sun, 4 Dec 2011 13:51:12 -0600 Subject: [PATCH 1/2] (#867) Set Type3 font encoding; enable text selection testing --- src/fonts.js | 6 ++++-- test/driver.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fonts.js b/src/fonts.js index 672739ea4..cc24f30c9 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -765,8 +765,10 @@ var Font = (function Font() { this.fontMatrix = properties.fontMatrix; this.widthMultiplier = 1.0; - if (properties.type == 'Type3') + if (properties.type == 'Type3') { + this.encoding = properties.baseEncoding; return; + } // Trying to fix encoding using glyph CIDSystemInfo. this.loadCidToUnicode(properties); @@ -2152,7 +2154,7 @@ var Font = (function Font() { }; }, - charsToGlyphs: function fonts_chars2Glyphs(chars) { + charsToGlyphs: function fonts_charsToGlyphs(chars) { var charsCache = this.charsCache; var glyphs; diff --git a/test/driver.js b/test/driver.js index ffaf0b53a..83f80ebed 100644 --- a/test/driver.js +++ b/test/driver.js @@ -167,7 +167,8 @@ function nextPage(task, loadError) { if (error) failureMessage = 'render : ' + error.message; snapshotCurrentPage(task, failureMessage); - } + }, + true ); } catch (e) { failure = 'page setup : ' + e.toString(); From 5909830d4327a1bbcdba54e55e5a7a66c8bc0beb Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Mon, 5 Dec 2011 17:19:43 -0600 Subject: [PATCH 2/2] Fixing the textLayer parameter --- test/driver.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/driver.js b/test/driver.js index 83f80ebed..2467b57a3 100644 --- a/test/driver.js +++ b/test/driver.js @@ -160,6 +160,10 @@ function nextPage(task, loadError) { canvas.height = pageHeight * pdfToCssUnitsCoef; clear(ctx); + // using non-attached to the document div to test + // text layer creation operations + var textLayer = document.createElement('div'); + page.startRendering( ctx, function nextPageStartRendering(error) { @@ -168,7 +172,7 @@ function nextPage(task, loadError) { failureMessage = 'render : ' + error.message; snapshotCurrentPage(task, failureMessage); }, - true + textLayer ); } catch (e) { failure = 'page setup : ' + e.toString();