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

Update repl-font.py #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update repl-font.py #133

wants to merge 1 commit into from

Conversation

june6423
Copy link

example_new_line.pdf
example_new_word.pdf
example_old.pdf
example.pdf

I discovered that the font-replacement code was not working, likely due to changes in the behavior of page.clean_contents() in PyMuPDF. To address this issue, I made several modifications to the file to restore functionality.

In the previous version, the logic resized the font to preserve the bounding box (bbox) of a line of text. However, I believe it is more appropriate to preserve the bbox of individual words to maintain the correct font size. Consequently, I changed the logic to preserve word bboxes.

I have attached the following files for reference:

  • example.pdf: The original input file.
  • example_old.pdf: The output generated by the previous version.
  • example_new_word.pdf: The output generated by the modified version with the new logic.
  • example_new_line.pdf: The output generated by the modified version without changing the original logic, to ensure the correction works.

Thank you for your time and consideration. Please let me know if you have any questions or need further information.

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.

None yet

1 participant