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

Refactor number of pages alias (fix #1090) #1203

Merged
merged 14 commits into from
Oct 30, 2024
Merged

Conversation

andersonhc
Copy link
Collaborator

@andersonhc andersonhc commented Jun 14, 2024

e.g. Fixes #0

Checklist:

  • The GitHub pipeline is OK (green),
    meaning that both pylint (static code analyzer) and black (code formatter) are happy with the changes of this PR.

  • A unit test is covering the code added / modified by this PR

  • This PR is ready to be merged

  • A mention of the change is present in CHANGELOG.md

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

fpdf/fpdf.py Outdated Show resolved Hide resolved
fpdf/fpdf.py Show resolved Hide resolved
Copy link
Collaborator

@gmischler gmischler left a comment

Choose a reason for hiding this comment

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

Alias = "A different name for something"

That's not really what we're dealing with here, at all.

Yes, I know that .str_alias_nb_pages has had that name for like forever, but maybe we shouldn't propagate it to all the internal code dealing with text substitution.
In #1202 I tried to use terminology that describes better what really happens. I probably haven't found the absolute best wording, but it may help as a more reasonable starting point.

Using names that don't actually reflect the purpose of the named elements makes the code really confusing to read and hard to understand. I'm not a native english speaker, but I like to be as precise as possible about those things.

Other than that, I expect the result to "just work"... 😉

@andersonhc
Copy link
Collaborator Author

@Lucas-C @gmischler
This PR should be ready now.
I renamed the internal methods from "alias" to "text substitution" but didn't touch the ones that already existed (like alias_nb_pages) to keep backwards compatibility.

Lucas, I changed the text shaping enable/disable test you created recently because after this change the replaced number of pages is similar with text shaping on or off. I replaced by a text with ligatures that have internal and visual differences.

@andersonhc andersonhc merged commit 9df0cae into py-pdf:master Oct 30, 2024
11 checks passed
@andersonhc andersonhc deleted the alias branch November 11, 2024 02:29
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.

3 participants