Skip to content

Retry formatted string update#53

Merged
rototor merged 9 commits into
rototor:masterfrom
fransbouwmans:master
Mar 29, 2025
Merged

Retry formatted string update#53
rototor merged 9 commits into
rototor:masterfrom
fransbouwmans:master

Conversation

@fransbouwmans

Copy link
Copy Markdown
Contributor

There was a conflict with your initial test, which has been resolved.
I do note that the output is still incorrect, but the test now shows that the attributed string (using the FormattedString to parse) results in output with sub, sup, strikethrough, bold, and italic text.

fransbouwmans and others added 5 commits June 21, 2023 08:38
Support AttributedString wit Family, Weight, and Posture attributes
Co-authored-by: sonatype-lift[bot] <37194012+sonatype-lift[bot]@users.noreply.github.com>
Removed prelim test in favor of new test using FormattedString
@sonatype-lift

sonatype-lift Bot commented Aug 2, 2023

Copy link
Copy Markdown
Contributor

Sonatype Lift is retiring

Sonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

@rototor

rototor commented Aug 3, 2023

Copy link
Copy Markdown
Owner

I'll have a look into this PR tomorrow. Thanks for working on this.

@fransbouwmans

Copy link
Copy Markdown
Contributor Author

Note that in the updated code there is a specific part where I assume a horizontal move, that is in order for the translation for subscript and superscript to work properly (i.e. be back on baseline when the sub/superscript ends). This is likely the cause for the incorrect behaviour that you are seeing when there is an additional transformation that is not straight.

@fransbouwmans

Copy link
Copy Markdown
Contributor Author

Got back to it , to try to resolve this issue and be back on the main branch.
Updated the drawing to have multiple matrices, so the font offset is treated separate from other transforms, such that the baseline is retained. I added a couple additional tests with rotated/formatted strings.
I believe the original transforms now do work properly (i.e. the pdf looks the same as the png).

@rototor

rototor commented May 4, 2024

Copy link
Copy Markdown
Owner

Thanks for persisting on this. I'll likely won't have time to look into this before Thuesday.

Comment thread pom.xml Outdated
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>

@rototor rototor May 11, 2024

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see why you prefer to set this to a value which allows to build with a current JDK. But we must stay on 1.6 here for compatibility with pdfbox-2.0. So you should use a JDK 8 to build this library. (E.g. Azul Zulu JDK 8 or something like this, which is current and maintained).

@rototor

rototor commented May 11, 2024

Copy link
Copy Markdown
Owner

Something I completely forgot to mention in the readme: I use the Apache PDFBox Coding Conventions here, not because I find them great (I don't), but to stay in sync style wise with PDFBox.

I've tested this by letting all test drivers run on this branch and then on master and compared the result. To do so, I did run all tests on master and copied the target/test directory somewhere as test_master and then did the same with your branch. It's a pitty, but there are some regressions especially with the transforms and underlines etc.

E.g.
master:
image
This PR:
image

Or
master:
image

This PR:
image

I've merged your new test drivers to master. But in your PR you deleted (I think because of a not correctly solved merge conflict) the "attributed_test_sup" test driver.

As it is now, this PR would be a regression. So please look into this again when you have time. Thank you for at least trying to improve the situation here.

@fransbouwmans

fransbouwmans commented May 11, 2024 via email

Copy link
Copy Markdown
Contributor Author

into rototor-master

Reformatted using pdfbox coding conventions
Changed to java 7 for compatibility with new jdk and per pdfbox guidance
@fransbouwmans

Copy link
Copy Markdown
Contributor Author

This was a though one, spend a lot of debugging to come to the conclusion that the font actually will take all attributes from the attributed string and build the applicable transform in most cases. So now the font is created from the text attributes (that is not the TextAttribute.FONT which is a special case).
Next problem was the offsets, which were applied first on the font, so that did not work well for applying after.
There is still one anomaly on the "attributed_transformed_text". It is not clear to me why the vectorized has the last line straight at an angle.

@rototor

rototor commented May 13, 2024

Copy link
Copy Markdown
Owner

Thanks doing work future here. I won't have time to look at this before next week :-(

@fransbouwmans

Copy link
Copy Markdown
Contributor Author

It has been a while, would be interested in getting this into a version with pdfbox 3.0 (for which you have done some work in another branch).
Let me know what I can do to get this merged.

@rototor

rototor commented Jan 20, 2025

Copy link
Copy Markdown
Owner

Sorry, time has really been a rare resource on my side the last year :-( I think I did some quick tests but found some issue, but I don't remember the details...

Yeah, I really should do a release of 2.x and 3.x branches with the newest releasted PDFBox versions ... but currently no idea when :-(

@fransbouwmans

Copy link
Copy Markdown
Contributor Author

Maybe a gentle ping to see if there is any time available to give this a push.
I'm still using my local patch on the 2.x release of pdfbox for this specific package and would like to move to 3.x and use a formally released package.

@rototor

rototor commented Mar 25, 2025

Copy link
Copy Markdown
Owner

Yeah, I see ... I set a reminder in my calender for Saturday. Hopefully that works out...

@rototor

rototor commented Mar 29, 2025

Copy link
Copy Markdown
Owner

There are still things which are not correct, like:
image
Should look like
attributed_transformed_text

But as it does not regress other tests as much as I can see, I'll merge that now.

@rototor
rototor merged commit f923380 into rototor:master Mar 29, 2025
@rototor

rototor commented Mar 29, 2025

Copy link
Copy Markdown
Owner

I've released version 0.45 with this change and an also updated version 3.0.3 for PDFBox 3.

@fransbouwmans

Copy link
Copy Markdown
Contributor Author

Great, I have updated my dependencies and am now using the 3.0.3 version, all looks good.
Thanks.

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

Successfully merging this pull request may close these issues.

2 participants