]> git.parisson.com Git - pdf.js.git/commitdiff
Merge to upstream
authorVivien Nicolas <21@vingtetun.org>
Thu, 21 Jul 2011 16:29:32 +0000 (18:29 +0200)
committerVivien Nicolas <21@vingtetun.org>
Thu, 21 Jul 2011 16:29:32 +0000 (18:29 +0200)
1  2 
fonts.js
pdf.js

diff --cc fonts.js
index 5a64a645ac7f41f24853fa4ab03ee993917c047a,f33cab9c366071eafe053b5ccb393923962424e3..76facb50424ae4a4cfa1886c5ffbda34bfc6613d
+++ b/fonts.js
@@@ -21,25 -21,11 +21,10 @@@ var kMaxWaitForFontFace = 1000
   *      http://cgit.freedesktop.org/poppler/poppler/tree/poppler/GfxFont.cc#n65
   */
  
- var Fonts = (function Fonts() {
+ var FontMeasure = (function FontMeasure() {
 -  var kScalePrecision = 40;
 -
 +  var kScalePrecision = 50;
-   var fonts = [];
-   if (!isWorker) {
-     var ctx = document.createElement('canvas').getContext('2d');
-     ctx.scale(1 / kScalePrecision, 1);
-   }
-   var fontCount = 0;
-   
-   function FontInfo(name, data, properties) {
-     this.name = name;
-     this.data = data;
-     this.properties = properties;
-     this.id = fontCount++;
-     this.loading = true;
-     this.sizes = [];
-   }
+   var ctx = document.createElement('canvas').getContext('2d');
+   ctx.scale(1 / kScalePrecision, 1);
  
    var current;
    var measureCache;
@@@ -372,10 -341,12 +340,11 @@@ function getUnicodeRangeFor(value) 
   *   var type1Font = new Font("MyFontName", binaryFile, propertiesObject);
   *   type1Font.bind();
   */
 -var Font = (function() {
 +var Font = (function Font() {
    var constructor = function font_constructor(name, file, properties) {
      this.name = name;
 -    this.textMatrix = properties.textMatrix || IDENTITY_MATRIX;
      this.encoding = properties.encoding;
+     this.sizes = [];
  
      // If the font is to be ignored, register it like an already loaded font
      // to avoid the cost of waiting for it be be loaded by the platform.
          break;
      }
      this.data = data;
 +    this.textMatrix = properties.textMatrix || IDENTITY_MATRIX;
      this.type = properties.type;
-     this.id = Fonts.registerFont(name, data, properties);
-     this.loadedName = 'pdfFont' + this.id;
+     this.loadedName = getUniqueName();
      this.compositeFont = properties.compositeFont;
    };
  
diff --cc pdf.js
index 32779f5d148346ebb43d8c388101b6d4c5e117f4,1f02d7d6d87c6866526bbfff707d20397c35e21d..385b4fe6ea5c99a0e2a59cd0179941935fcac1b5
--- 1/pdf.js
--- 2/pdf.js
+++ b/pdf.js
@@@ -4119,10 -4094,8 +4102,10 @@@ var CanvasGraphics = (function() 
        if (this.ctx.$setFont) {
          this.ctx.$setFont(fontName, size);
        } else {
-         Fonts.setActive(fontName, fontObj, size);
 -        this.ctx.font = size + 'px "' + fontName + '"';
+         FontMeasure.setActive(fontObj, size);
 +
 +        size = (size <= kRasterizerMin) ? size * kScalePrecision : size;
 +        this.ctx.font = size + 'px "' + fontName + '"';
        }
      },
      setTextRenderingMode: function(mode) {