-
Notifications
You must be signed in to change notification settings - Fork 253
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
Added TextStyle Horizontal Alignment #1300
base: master
Are you sure you want to change the base?
Added TextStyle Horizontal Alignment #1300
Conversation
please remove the "generate=True" from the test below: Run # Ensuring there is no |
Hi @andersonhc, Added commit to remove |
The test on python 3.9 is failing due to use of pipe to union. That feature was introduced in Python 3.10 Can you replace it by Union so we can keep compatibility with older Python versions? |
Hi @andersonhc, Replaced pipe operator with |
# added support for 'Align' and 'str' type values for l_margin | ||
if isinstance(l_margin, (Align, int)): | ||
self.l_margin = l_margin | ||
elif isinstance(l_margin, str): | ||
self.l_margin = Align.coerce(l_margin) | ||
else: | ||
self.l_margin = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# added support for 'Align' and 'str' type values for l_margin | |
if isinstance(l_margin, (Align, int)): | |
self.l_margin = l_margin | |
elif isinstance(l_margin, str): | |
self.l_margin = Align.coerce(l_margin) | |
else: | |
self.l_margin = 0 | |
self.l_margin = Align.coerce(l_margin) |
Isn't this one line enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Lucas-C,
I dont think Align.coerce can handle integer values, so I added conditions for the 3 possible types integer, string and Align.
Good job overall @visheshdvivedi 👍 The GitHub Actions pipeline is currently failing: Run black --check .
Skipping .ipynb files as Jupyter dependencies are not installed.
You can fix this by running ``pip install "black[jupyter]"``
would reformat /home/runner/work/fpdf2/fpdf2/test/outline/test_outline.py
would reformat /home/runner/work/fpdf2/fpdf2/fpdf/fpdf.py
Oh no! 💥 💔 💥
2 files would be reformatted, 188 files would be left unchanged. To solve this, you could either install & setup Once you'll have rebased your branch on this repo "title": TextStyle( # Only rendered if render_title_tag=True
b_margin=0.4,
font_size_pt=30,
t_margin=6,
# center=True, - Enable this once #1282 is implemented
), This comes from PR #1298. |
Just for your information, several occurences of I think this caused minor issues in your PR when you rebased your branch:
|
Hi @visheshdvivedi 🙂 Just to get a quick update: do you still want to implement this feature? |
Hi @Lucas-C , Yes, very much. Aplogies for the delay on my side, have been occupied for sometime in personal tasks. But I will try to put more time on this and complete it. |
Added horizontal alignment feature for TextStyle.
Fixes #1282
Checklist:
A unit test is covering the code added / modified by this PR
This PR is ready to be merged
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.md
I couldn't find any docstring and a dedicated section as documentation for TextStyle. Please message me if it exists, will update it accordingly
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.