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

{nb} text shaping breakage can't be worked around anymore #1287

Closed
philj56 opened this issue Oct 17, 2024 · 9 comments
Closed

{nb} text shaping breakage can't be worked around anymore #1287

philj56 opened this issue Oct 17, 2024 · 9 comments

Comments

@philj56
Copy link

philj56 commented Oct 17, 2024

Related to #1090:

In fpdf2 2.7.7, it was possible to work around text shaping breaking {nb} by temporarily disabling it (as is done in the example in #1090). From 2.7.8 onwards, this is no longer possible; enabling text shaping once breaks all subsequent {nb}s, even if it is disabled again.

Minimal example:

from fpdf import FPDF

pdf = FPDF()
pdf.add_font('mulish', style='', fname='mulish-regular.ttf')
pdf.add_page()
pdf.set_font('mulish', '', 24)
pdf.write(text='Pages {nb}')
pdf.ln()
pdf.set_text_shaping(True)
pdf.write(text='Pages {nb}')
pdf.ln()
pdf.set_text_shaping(False)
pdf.write(text='Pages {nb}')
pdf.output('test.pdf')

With fpdf2 2.7.7:
before

With fpdf2 2.7.8+:
after

@Lucas-C
Copy link
Member

Lucas-C commented Oct 17, 2024

Hi @philj56

Thank you for the report.

This is in fact a known limitation:

Maybe the existing issue #1090 is enough to track this?
Do you see extra value in your bug report compared to the information already in #1090? 🙂

@philj56
Copy link
Author

philj56 commented Oct 17, 2024

Hi @Lucas-C,

It's a known limitation, but you used to still be able to get page numbers to work by temporarily disabling text shaping just for the page number, then re-enabling it. This is no longer possible, so it seems like something else has changed internally and this might be a different issue, something like text shaping not being disabled when expected. (e.g. the example code given in #1090 no longer produces the same output).

I think the information here is useful in addition to that in #1090, but I'm happy for them to be merged / handled however you see fit.

@Lucas-C
Copy link
Member

Lucas-C commented Oct 17, 2024

You are right @philj56, the problem is elswewhere.

I think I found the issue & fixed it in PR #1288

@allcontributors please add @philj56 for bug

Copy link

@Lucas-C

I've put up a pull request to add @philj56! 🎉

@philj56
Copy link
Author

philj56 commented Oct 17, 2024

That's great, thanks for the quick reply and fix!

@Lucas-C
Copy link
Member

Lucas-C commented Oct 17, 2024

@philj56 Could you please test if this issue is solved for you using the latest version of fpdf2 from git? 🙂

You can install it with: pip install git+https://github.com/py-pdf/fpdf2.git@master

@philj56
Copy link
Author

philj56 commented Oct 18, 2024

@Lucas-C Yup, that seems to be working fine now, thanks!

@Lucas-C
Copy link
Member

Lucas-C commented Oct 18, 2024

Thank you for testing 👍

@Lucas-C
Copy link
Member

Lucas-C commented Dec 16, 2024

This fixup has been included in the new release published today:
https://github.com/py-pdf/fpdf2/releases/tag/2.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants