mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Use adjustWidths
for TrueType fonts if we handle them as OpenType (issue 5027, issue 5084, issue 6556, bug 1204903)
In `Font_checkAndRepair` we can decide that a font isn't TrueType, and instead parse it as CFF. In that case it's quite possible that the `fontMatrix` will be changed, and without calling `adjustWidths` we're failing to update the glyph widths correctly. Fixes 5027. Fixes 5084. Fixes 6556. Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1204903.
This commit is contained in:
parent
084bb8682f
commit
ee0d522187
4 changed files with 15 additions and 0 deletions
|
@ -2133,6 +2133,9 @@ function reverseIfRtl(chars) {
|
|||
}
|
||||
|
||||
function adjustWidths(properties) {
|
||||
if (!properties.fontMatrix) {
|
||||
return;
|
||||
}
|
||||
if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
|
||||
return;
|
||||
}
|
||||
|
@ -2647,6 +2650,8 @@ var Font = (function FontClosure() {
|
|||
// view of the sanitizer
|
||||
data = this.checkAndRepair(name, file, properties);
|
||||
if (this.isOpenType) {
|
||||
adjustWidths(properties);
|
||||
|
||||
type = 'OpenType';
|
||||
}
|
||||
break;
|
||||
|
@ -4079,6 +4084,8 @@ var Font = (function FontClosure() {
|
|||
cffFile = new Stream(tables['CFF '].data);
|
||||
cff = new CFFFont(cffFile, properties);
|
||||
|
||||
adjustWidths(properties);
|
||||
|
||||
return this.convert(name, cff, properties);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue