fix: protect page count alias from UBA reordering (issue #1925) - #1929
Open
prateek-dagar wants to merge 2 commits into
Open
fix: protect page count alias from UBA reordering (issue #1925)#1929prateek-dagar wants to merge 2 commits into
prateek-dagar wants to merge 2 commits into
Conversation
andersonhc
requested changes
Aug 28, 2026
| pdf.set_text_shaping(False) | ||
| pdf.cell(text="אבג {nb} דהו", align="R") | ||
| assert_pdf_equal(pdf, HERE / "alias_in_rtl_text.pdf", tmp_path) | ||
|
|
Collaborator
There was a problem hiding this comment.
Suggested change
| def test_alias_in_middle_with_shaping_markdown(tmp_path): | |
| pdf = fpdf.FPDF() | |
| pdf.add_font("Quicksand", style="", fname=HERE / "fonts" / "Quicksand-Regular.otf") | |
| pdf.add_font("Quicksand", style="B", fname=HERE / "fonts" / "Quicksand-Bold.otf") | |
| pdf.add_page() | |
| pdf.set_font("Quicksand", size=24) | |
| pdf.set_text_shaping(True) | |
| pdf.multi_cell(w=pdf.epw, text="**Pages {nb}** with shaping", markdown=True) | |
| assert_pdf_equal(pdf, HERE / "alias_in_middle_with_shaping_markdown.pdf", tmp_path) |
Can you add a test to make sure it's not breaking markdown?
Author
There was a problem hiding this comment.
The test case test_alias_in_middle_with_shaping_markdown already exists in the test suite.
Additionally, I have added a new test case test_alias_in_rtl_text_markdown to cover markdown formatting with RTL text shaping.
prateek-dagar
force-pushed
the
fix-issue-1925
branch
from
August 28, 2026 15:03
027aa37 to
b3a99d5
Compare
prateek-dagar
force-pushed
the
fix-issue-1925
branch
from
August 28, 2026 15:10
b3a99d5 to
919c52e
Compare
Author
|
Hi @andersonhc, I updated the branch to fix the markdown formatting issue:
All tests are now passing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Replace the alias with a single placeholder PUA character (
\uE000with collision-safe scanning) before UBA bidi processing.Because a single character is atomic, it survives UBA reordering intact at its correct semantic location.
Reconstruct the bidi fragments by expanding the PUA placeholder back into a
TotalPagesSubstitutionFragment.Fixes #1925
A unit test is covering the code added / modified by this PR
In case of a new feature, docstrings have been added, with also some documentation in the
docs/folderA mention of the change is present in
CHANGELOG.mdThis PR is ready to be merged
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.