Skip to content

Commit

Permalink
Extended the fix for issue #42 and added additional hybrid dual boldi…
Browse files Browse the repository at this point in the history
…talic font detection
  • Loading branch information
todorowww committed Jan 24, 2017
1 parent 5073ed1 commit 35b5356
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/pdffont.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ let PDFFont = (function PFPFontClosure() {
this.bold = this.typeName.indexOf("bold") >= 0 || this.typeName.indexOf("black") >= 0;
}
this.italic = fontObj.italic; // fix https://github.com/modesty/pdf2json/issues/42
// Extended the fix for https://github.com/modesty/pdf2json/issues/42
if (!this.italic) {
this.italic = this.typeName.indexOf("italic") >= 0 || this.typeName.indexOf("oblique") >= 0;
}
// Added detection of hybrid dual bolditalic fonts
if (((!this.bold) || (!this.italic)) && (this.typeName.indexOf("boldobl") >= 0)) {
this.bold = true;
this.italic = true;
}

let typeName = this.subType;
if (fontObj.isSerifFont) {
Expand Down Expand Up @@ -382,4 +391,3 @@ let PDFFont = (function PFPFontClosure() {
})();

module.exports = PDFFont;

0 comments on commit 35b5356

Please sign in to comment.