-
Notifications
You must be signed in to change notification settings - Fork 22
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
Update PdfBoxGraphics2DFontTextDrawer.java #52
Conversation
Support AttributedString wit Family, Weight, and Posture attributes
Thanks for the PullRequest. I'll try to look into integrating this and release a new version tomorrow evening. |
Thanks
Note that I normally not work on Github and was not able to assign the issue to the pull request.
Frans
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Emmeran Seehuber ***@***.***>
Sent: Wednesday, June 21, 2023 9:11:16 AM
To: rototor/pdfbox-graphics2d ***@***.***>
Cc: Frans Bouwmans ***@***.***>; Author ***@***.***>
Subject: Re: [rototor/pdfbox-graphics2d] Update PdfBoxGraphics2DFontTextDrawer.java (PR #52)
Thanks for the PullRequest. I'll try to look into integrating this and release a new version tomorrow evening.
—
Reply to this email directly, view it on GitHub<#52 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAE7NEE3P6EXVPFJ4JCHW4LXMLXHJANCNFSM6AAAAAAZOWFIJU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
This works by using the issue number like #51 in the title and/or commit message. That way you get the link to the issue. So it's just using markup for that. |
Had a look at the super/subscript and there is an easy way to get the Font with transform for this. However the current use of the transform does not seem to be correct. i.e. a text with several segments having different attributes and with a transform does not continue properly.
So in order for this to work, we need:
I will continue to look and see if there is a solution |
graphics2d/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java
Outdated
Show resolved
Hide resolved
graphics2d/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DFontTextDrawer.java
Outdated
Show resolved
Hide resolved
🛠 Lift Auto-fixSome of the Lift findings in this PR can be automatically fixed. You can download and apply these changes in your local project directory of your branch to review the suggestions before committing.1 # Download the patch
curl https://lift.sonatype.com/api/patch/github.com/rototor/pdfbox-graphics2d/52.diff -o lift-autofixes.diff
# Apply the patch with git
git apply lift-autofixes.diff
# Review the changes
git diff Want it all in a single command? Open a terminal in your project's directory and copy and paste the following command: curl https://lift.sonatype.com/api/patch/github.com/rototor/pdfbox-graphics2d/52.diff | git apply Once you're satisfied, commit and push your changes in your project. Footnotes |
Updated handling of attributeFont with transform (such as superscript and subscript). This showed some issues with current implementation. Not a clean solution as the tranform matrix from the font is applied to the matrix of the contentstream. As a result moving forward on the baseline is not correct. This should now be resolved, however testing was limited to specific transforms introduced by superscript and subscript. Unclear what other transforms can happen and how they may impact the result. |
I do note that the specific source file has a deviating source formatting, an automatic source format changed a lot. I undid most to allow for a better review, but it would be good to apply standard java (or eclipse) formatting to the source file. |
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
The source formating looks a bit strange, but it's the coding convention of PDFBox. |
This code is all very tricky. And still not 100% right. And I can get no super or sub script to work at all. Would you mind providing your test code? ==> There is a class FontTest in the tests. Just Copy&Paste the first testAntonioFont() method and insert your code there. And rename the outfile (second argument of exportGraphics). Then you get a target/test/fonts/.png and a target/test/fonts/.pdf. The png is generated using a BufferedImage, i.e. it's the "so it should look like" case. And the PDF contains multiply pages with different font rendering settings and scalings of the form (because sometimes gradients look different depending on the outside scaling; Yes thats another bug I still have in this project) Your changes change the (already not correct) matrix support code. E.g. the FontTest::testTransformedFont case. Before it was But it should really look like ==> Please provide a test method in FontTest. As I can't get superscript and subscript it to work with this branch. See this new testmethod in master. You don't need to fix the font transformed case, but just a test case that I can see that your changes really work. |
Will do, but for me this is weekend work, so may take a bit.
Frans
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Emmeran Seehuber ***@***.***>
Sent: Sunday, June 25, 2023 4:24:10 PM
To: rototor/pdfbox-graphics2d ***@***.***>
Cc: Frans Bouwmans ***@***.***>; Author ***@***.***>
Subject: Re: [rototor/pdfbox-graphics2d] Update PdfBoxGraphics2DFontTextDrawer.java (PR #52)
This code is all very tricky. And still not 100% right. And I can get no super or sub script to work at all.
Would you mind providing your test code? ==> There is a class FontTest in the tests. Just Copy&Paste the first testAntonioFont() method and insert your code there. And rename the outfile (second argument of exportGraphics). Then you get a target/test/fonts/.png and a target/test/fonts/.pdf. The png is generated using a BufferedImage, i.e. it's the "so it should look like" case. And the PDF contains multiply pages with different font rendering settings and scalings of the form (because sometimes gradients look different depending on the outside scaling; Yes thats another bug<#44> I still have in this project)
Your changes change the (already not correct) matrix support code. E.g. the FontTest::testTransformedFont case. Before it was
[image]<https://user-images.githubusercontent.com/711674/248584921-847f7d65-66f8-4666-8889-95ed624b6806.png>
but with your changes this looks like this
[image]<https://user-images.githubusercontent.com/711674/248584953-fdffd8f1-2eeb-4831-a6f9-54551182c0aa.png>
But it should really look like
[attributed_transformed_text]<https://user-images.githubusercontent.com/711674/248584965-fd7a8ad8-e8ec-4e58-bd1d-f8dfe0821a42.png>
==> Please provide a test method in FontTest. As I can't get superscript and subscript it to work with this branch. See this new testmethod in master<https://github.com/rototor/pdfbox-graphics2d/blob/master/graphics2d/src/test/java/de/rototor/pdfbox/graphics2d/FontTest.java#L75>.
You don't need to fix the font transformed case, but just a test case that I can see that your changes really work.
—
Reply to this email directly, view it on GitHub<#52 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAE7NEGCTHQWZTRRDPZQESTXNCM6VANCNFSM6AAAAAAZOWFIJU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Not sure how to merge the updated master, close and will try a new pull request |
Support AttributedString wit Family, Weight, and Posture attributes