mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
BaseFont and misc fonts fixes
This commit is contained in:
parent
b49a0f6b63
commit
aad77fcc55
4 changed files with 30 additions and 8 deletions
16
fonts.js
16
fonts.js
|
@ -7,7 +7,7 @@ var isWorker = (typeof window == 'undefined');
|
|||
/**
|
||||
* Maximum file size of the font.
|
||||
*/
|
||||
var kMaxFontFileSize = 200000;
|
||||
var kMaxFontFileSize = 300000;
|
||||
|
||||
/**
|
||||
* Maximum time to wait for a font to be loaded by font-face rules.
|
||||
|
@ -83,7 +83,7 @@ var FontMeasure = (function FontMeasure() {
|
|||
var bold = font.bold ? 'bold' : 'normal';
|
||||
var italic = font.italic ? 'italic' : 'normal';
|
||||
size *= kScalePrecision;
|
||||
var rule = bold + ' ' + italic + ' ' + size + 'px "' + name + '"';
|
||||
var rule = italic + ' ' + bold + ' ' + size + 'px "' + name + '"';
|
||||
ctx.font = rule;
|
||||
},
|
||||
measureText: function fonts_measureText(text) {
|
||||
|
@ -395,17 +395,23 @@ var Font = (function Font() {
|
|||
// 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.
|
||||
if (properties.ignore) {
|
||||
this.loadedName = 'Arial';
|
||||
this.loadedName = 'sans-serif';
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!file) {
|
||||
var fontName = stdFontMap[name];
|
||||
// The file data is not specified. Trying to mingle the font name
|
||||
// to be used with the canvas.font.
|
||||
var fontName = stdFontMap[name] || name.replace('_', '-');
|
||||
this.bold = (fontName.indexOf('Bold') != -1);
|
||||
this.italic = (fontName.indexOf('Oblique') != -1);
|
||||
this.italic = (fontName.indexOf('Oblique') != -1) ||
|
||||
(fontName.indexOf('Italic') != -1);
|
||||
this.loadedName = fontName.split('-')[0];
|
||||
this.loading = false;
|
||||
this.charsToUnicode = function(s) {
|
||||
return s;
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue