Moving defaultWidth into the charsToGlyphs function
This commit is contained in:
parent
0b1b8da982
commit
391ec1f99a
10
fonts.js
10
fonts.js
@ -1373,7 +1373,10 @@ var Font = (function Font() {
|
||||
var glyph = encoding[charcode];
|
||||
if ('undefined' == typeof(glyph)) {
|
||||
warn('Unencoded charcode ' + charcode);
|
||||
glyph = { unicode: charcode };
|
||||
glyph = {
|
||||
unicode: charcode,
|
||||
width: this.defaultWidth
|
||||
};
|
||||
}
|
||||
glyphs.push(glyph);
|
||||
// placing null after each word break charcode (ASCII SPACE)
|
||||
@ -1387,7 +1390,10 @@ var Font = (function Font() {
|
||||
var glyph = encoding[charcode];
|
||||
if ('undefined' == typeof(glyph)) {
|
||||
warn('Unencoded charcode ' + charcode);
|
||||
glyph = { unicode: charcode };
|
||||
glyph = {
|
||||
unicode: charcode,
|
||||
width: this.defaultWidth
|
||||
};
|
||||
}
|
||||
glyphs.push(glyph);
|
||||
if (charcode == 0x20)
|
||||
|
3
pdf.js
3
pdf.js
@ -4989,7 +4989,6 @@ var CanvasGraphics = (function() {
|
||||
ctx.transform.apply(ctx, font.textMatrix || IDENTITY_MATRIX);
|
||||
|
||||
var glyphs = font.charsToGlyphs(text);
|
||||
var defaultCharWidth = font.defaultWidth;
|
||||
var fontSize = current.fontSize;
|
||||
var charSpacing = current.charSpacing;
|
||||
var wordSpacing = current.wordSpacing;
|
||||
@ -5010,7 +5009,7 @@ var CanvasGraphics = (function() {
|
||||
String.fromCharCode(0xD800 | ((unicode - 0x10000) >> 10),
|
||||
0xDC00 | (unicode & 0x3FF)) : String.fromCharCode(unicode);
|
||||
|
||||
var charWidth = (glyph.width || defaultCharWidth) * fontSize * 0.001;
|
||||
var charWidth = glyph.width * fontSize * 0.001;
|
||||
charWidth += charSpacing;
|
||||
|
||||
ctx.fillText(char, width, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user