You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please explain your intent
I am using fpdf2 to produce reports using verified translations in multiple languages, using the template features to define the report layout. One of my collaborators validating our Japanese language report advised that inappropriate line breaks were occurring. Investigating this, I see that is because there are not spaces in this language, and wrapping should be by character not word.
I see there is functionality to optionally support word wrapping based on character instead of word when using the non-template approach to pdf construction with multicell() or write() using the option wrapmode="CHAR" (as per fpdf2 documentation). However, I don't believe this is configurable when using a template to define the PDF layout, or if it is I don't believe this is documented.
Describe the solution you'd like
Allowing the option to set wrapmode="CHAR" within a template, or providing guidance on how to achieve this effect would be greatly appreciated and very useful. This could be another parameter, e.g. like 'align' or 'rotate'. It need only be used for the relevant text formatting types, and have a default of 'word' but option to set otherwise (i.e. to 'CHAR', for scripts like Chinese and Japanese, etc).
I'm hopeful this could be relatively straightforward to implement, given the existing technical functionality to do this (which is great, thank you!).
The text was updated successfully, but these errors were encountered:
Yes, this is one of the many limitations that currently plague our template system (as evicenced eg. by #1119).
One of the reasons for that is the CSV input file format, which makes it rather annoying to have many different fields or even different record types in the first place. I think we should find a more structured replacement for that rather soon. JSON might be a candidate, or maybe even the ini file format would be good enough.
But for the time being, adding arguments to records that are only accessible through literal dict definitions is perfectly acceptable.
If you feel up to it, a PR would be very welcome.
Hi @gmischler thanks for getting back to me and the pointers for how this could be addressed --- I'll have a look later this week to see if this is something I can figure out; if I can make some progress, I'll make a PR. Its a great project, and if I am able to make a contribution, would love to.
I'll have a look later this week to see if this is something I can figure out; if I can make some progress, I'll make a PR. Its a great project, and if I am able to make a contribution, would love to.
Great! Thank you for considering a contribution to fpdf2 👍
A good starting point for contributing should be this documentation page: https://py-pdf.github.io/fpdf2/Development.html
Feel free to ask any question if you face problems during the process!
Please explain your intent
I am using fpdf2 to produce reports using verified translations in multiple languages, using the template features to define the report layout. One of my collaborators validating our Japanese language report advised that inappropriate line breaks were occurring. Investigating this, I see that is because there are not spaces in this language, and wrapping should be by character not word.
I see there is functionality to optionally support word wrapping based on character instead of word when using the non-template approach to pdf construction with
multicell()
orwrite()
using the optionwrapmode="CHAR"
(as per fpdf2 documentation). However, I don't believe this is configurable when using a template to define the PDF layout, or if it is I don't believe this is documented.Describe the solution you'd like
Allowing the option to set
wrapmode="CHAR"
within a template, or providing guidance on how to achieve this effect would be greatly appreciated and very useful. This could be another parameter, e.g. like 'align' or 'rotate'. It need only be used for the relevant text formatting types, and have a default of 'word' but option to set otherwise (i.e. to 'CHAR', for scripts like Chinese and Japanese, etc).I'm hopeful this could be relatively straightforward to implement, given the existing technical functionality to do this (which is great, thank you!).
The text was updated successfully, but these errors were encountered: