Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Italics not working #42

Closed
RocketRooster opened this issue Aug 6, 2015 · 1 comment
Closed

Italics not working #42

RocketRooster opened this issue Aug 6, 2015 · 1 comment

Comments

@RocketRooster
Copy link

Dear Mr. Zhang,

The Italic field (TS[3]) is always zero regardless of whether the text field is Italic or not. After digging in pdffont.js for a bit, I figured out that it's because the value is always the initial value (false) set in the constructor and it is never set anywhere else.

In my case, I corrected the issue by making this very simple change to pdffont.js:

    var _setFaceIndex = function() {
        var fontObj = this.fontObj;

        this.bold = fontObj.bold;
        if (!this.bold) {
            this.bold = this.typeName.indexOf("bold") >= 0 || this.typeName.indexOf("black") >= 0;
        }

        this.italic = fontObj.italic;  // <---- Added this line only

Please note that Bold works as advertised. I notice that you are also analyzing the typeface name to distinguish between bold and normal text in the case of "pseudobold" text fonts, I have not done anything like that for italics so it probably won't work for typefaces that oblique by design but not by formatting.

I have not forked the project so please accept this issue and code snippet in lieu of a pull request. :)

Yours faithfully,
Riaan

PS. Thanks for the package, it's much appreciated!

modesty pushed a commit that referenced this issue Mar 10, 2016
@modesty
Copy link
Owner

modesty commented Mar 10, 2016

fixed in v1.1.1, thanks.

@modesty modesty closed this as completed Mar 10, 2016
todorowww pushed a commit to todorowww/pdf2json that referenced this issue Jan 24, 2017
todorowww added a commit to todorowww/pdf2json that referenced this issue Jan 24, 2017
modesty added a commit that referenced this issue Nov 10, 2023
modesty pushed a commit that referenced this issue Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants