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

Feature request: allow horizontal centering in TextStyle #1282

Open
Lucas-C opened this issue Oct 11, 2024 Discussed in #1280 · 2 comments
Open

Feature request: allow horizontal centering in TextStyle #1282

Lucas-C opened this issue Oct 11, 2024 Discussed in #1280 · 2 comments

Comments

@Lucas-C
Copy link
Member

Lucas-C commented Oct 11, 2024

Proposed solution

  1. Allow Align.C to be passed as a value for .l_margin in TextStyle
  2. When this .l_margin is used in FPDF._use_title_style(), if it is Align.C, then horizontally align the text

The PR implementing this should include unit tests using FPDF.start_section()

Discussed in #1280

Originally posted by Benoite142 October 10, 2024
Hi,

I've been trying to center a TitleStyle for quite some time now. I've been using a TitleStyle for the start_section function used in the TOC placeholder and I am having a lot of trouble trying to center the TitleStyle. I know we can easily center some cell or text with align='C' but I found no way of doing that for the TitleStyle. I know we can put a value to the l_margin to make it look like it is centered, but I can't really use that since all of my titles differs in length.

I also tried aligning everything to the center of the page, but that still doesn't work with TitleStyle and the sections.
Worst case scenario is that I put everything on the left, but I would really want it to be centered.

If anyone knows how I could do this, please let me know.

Thank you for you time 😊

@Lucas-C
Copy link
Member Author

Lucas-C commented Oct 11, 2024

@allcontributors please add @Benoite142 for ideas

Copy link

@Lucas-C

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

@Lucas-C Lucas-C changed the title Feature request: allow horizontal centering in TitleStyle Feature request: allow horizontal centering in TextStyle Oct 11, 2024
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

1 participant