Add FONT_IDENTITY_MATRIX for calculating glyph x position

This commit is contained in:
Michal Szczepanski 2019-07-22 23:20:37 +02:00
parent 99bd258317
commit f7fc939832
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,8 @@
// See pdf.js shared/utils.js
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
module.exports = {
IDENTITY_MATRIX,
FONT_IDENTITY_MATRIX,
}

View File

@ -25,7 +25,7 @@ class ExtractText {
partial += glyph.unicode;
const width = glyph.width;
// const widthAdvanceScale = font.size * line.fontMatrix[0];
const widthAdvanceScale = font.size * Constraints.IDENTITY_MATRIX[0];
const widthAdvanceScale = font.size * Constraints.FONT_IDENTITY_MATRIX[0];
const charWidth = width * widthAdvanceScale + spacing * font.direction;
x += charWidth;
}