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

Write() refactor to use new line wrapping code #346

Merged
merged 87 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
71bd53d
Fix parsing of csv template files
gmischler Sep 18, 2021
d70bc37
fixes suggested by static code check
gmischler Sep 18, 2021
6ed9686
Update template.py
gmischler Sep 19, 2021
fa62a8d
now it's dark.
gmischler Sep 20, 2021
f1d7802
do some hardcoded template tests without multiline
gmischler Sep 21, 2021
ec69b8f
first round Splitting Template() into FlexTemplate()
gmischler Sep 25, 2021
6771592
offset and rotate for render(), first test
gmischler Sep 25, 2021
536e819
small fixes and cleanup
gmischler Sep 25, 2021
42e0d27
removing mistaken checkin
gmischler Sep 25, 2021
5b1d889
test for multipage Template(); Template.code39 with standard template…
gmischler Sep 26, 2021
92c9e28
refer defaults to type handlers, x2 optional for barcodes
gmischler Sep 26, 2021
0195db4
more template and flextemplate tests
gmischler Sep 26, 2021
bb97a63
Merge remote-tracking branch 'upstream/master'
gmischler Sep 26, 2021
e5ab09c
static check fixes
gmischler Sep 26, 2021
fdb03de
more pylint
gmischler Sep 26, 2021
56f639e
blackity-black
gmischler Sep 26, 2021
bef03d1
even blacker
gmischler Sep 26, 2021
cad0264
Expand docstrings, update help, hide private methods.
gmischler Sep 29, 2021
0f99984
Issues from PR review
gmischler Sep 29, 2021
1af4365
Merge remote-tracking branch 'upstream/master'
gmischler Sep 29, 2021
bba1ca1
Issue #226 solved: Rotate anything anywhere
gmischler Sep 30, 2021
b89147a
Issue #238 solved - split_multicell doesn't modify target document
gmischler Sep 30, 2021
13e9739
Documentation details and corrections
gmischler Sep 30, 2021
058f7ea
breaking up long line
gmischler Sep 30, 2021
5807548
rotation fix slightly changed barcode output
gmischler Sep 30, 2021
557148a
Update CHANGELOG.md
gmischler Sep 30, 2021
ddba2ce
Include _write() in template rotation test
gmischler Sep 30, 2021
4847792
FlexTemplate.render() with scaling
gmischler Oct 1, 2021
6f2c98f
empty text field - consistency between T and W
gmischler Oct 2, 2021
2b2d82e
Enforce user input types as early as possible
gmischler Oct 2, 2021
b00666d
Merge remote-tracking branch 'upstream/master'
gmischler Oct 2, 2021
ba9ab80
Fix to make sure deprecated code39 arguments still work
gmischler Oct 2, 2021
a746ef7
sync to upstream
gmischler Oct 2, 2021
7c9fcdb
some more test coverage
gmischler Oct 2, 2021
03814bb
pylint asking for style points...
gmischler Oct 2, 2021
d09688c
picky black...
gmischler Oct 2, 2021
f8febaa
Merge branch 'PyFPDF:master' into master
gmischler Oct 3, 2021
546d5b2
Merge remote-tracking branch 'upstream/master'
gmischler Oct 8, 2021
294287c
Change background default to transparent
gmischler Oct 8, 2021
431d918
Add ellipse element to templates
gmischler Oct 8, 2021
753c246
Bugfix skipping check for x2 with barcods
gmischler Oct 8, 2021
112f496
More template tests
gmischler Oct 8, 2021
d5de0e2
code cleanup
gmischler Oct 8, 2021
605acb1
list template changes to log
gmischler Oct 9, 2021
a256212
expose FlexTemplate through __init__.__all__
gmischler Oct 9, 2021
de230b8
Merge remote-tracking branch 'upstream/master'
gmischler Oct 11, 2021
2582afb
bugfix: Keep track of nested rotation contexts
gmischler Oct 11, 2021
a6501f3
test fix: text file loaded in binary mode
gmischler Oct 13, 2021
f26a873
new set_dash_pattern(); dashed_line() retired
gmischler Oct 14, 2021
325566c
Merge remote-tracking branch 'upstream/master'
gmischler Oct 14, 2021
bae8b76
test update for deprecated dashed_line()
gmischler Oct 14, 2021
007e00b
mask unused argument in test
gmischler Oct 14, 2021
a96bcc3
error message fix, expand test coverage
gmischler Oct 14, 2021
b04c879
updates based on PR review
gmischler Oct 15, 2021
41672c5
Merge remote-tracking branch 'upstream/master'
gmischler Oct 16, 2021
f5573ef
Graphics state stack implemented, rotation fixed
gmischler Oct 18, 2021
fec5188
Simplify Templates again, making use of flexible rotation
gmischler Oct 31, 2021
c201180
code cleanup
gmischler Oct 31, 2021
cdcdf37
Merge remote-tracking branch 'upstream/master'
gmischler Oct 31, 2021
f4f2dd0
merging updates from upstream
gmischler Oct 31, 2021
35df15b
Update flextemplate_rotation.pdf
gmischler Oct 31, 2021
6c46a5f
Merge remote-tracking branch 'upstream/master'
gmischler Nov 2, 2021
5ebb144
Updating changelog
gmischler Nov 2, 2021
e1299a2
Merge remote-tracking branch 'upstream/master'
gmischler Nov 10, 2021
604a6b0
include line_width in graphics context stack
gmischler Nov 10, 2021
29c4266
hopefully fixing line endings
gmischler Nov 10, 2021
516be96
changes discussed in PR review
gmischler Nov 12, 2021
18bd976
migrating test_regular_polygon.py to standard fixture
gmischler Nov 12, 2021
5747acc
Merge branch 'PyFPDF:master' into master
gmischler Nov 13, 2021
e8507ec
Merge branch 'PyFPDF:master' into master
gmischler Feb 12, 2022
f24a4cf
Merge branch 'PyFPDF:master' into master
gmischler Feb 20, 2022
99a03a8
initial working write() refactor
gmischler Feb 24, 2022
0d90739
replace ln=0 internally with newpos_x/newpos_y
gmischler Feb 25, 2022
6e68780
renaming test/cells to test/text, moving rext related tests there
gmischler Feb 25, 2022
2c85c61
test cases for write() and _render_styled_cell_text()
gmischler Feb 26, 2022
427b61b
Move word spacing code to _render_styled_cell_text()
gmischler Mar 2, 2022
27b85f4
Merge branch 'PyFPDF:master' into master
gmischler Mar 3, 2022
fb7dfac
Merge branch 'PyFPDF:master' into write_refactor
gmischler Mar 3, 2022
c7d911b
print_sh option for write() and multi_cell()
gmischler Mar 3, 2022
2774b24
Merge branch 'write_refactor' of https://github.com/gmischler/fpdf2 i…
gmischler Mar 3, 2022
ff3b19a
tabs to spaces
gmischler Mar 3, 2022
5884cc8
Apply PR review
gmischler Mar 4, 2022
c99ac7d
Merge branch 'PyFPDF:master' into master
gmischler Mar 5, 2022
155f758
Merge branch 'master' into write_refactor
gmischler Mar 5, 2022
baee4b7
merge origin updates
gmischler Mar 5, 2022
ce2fc7c
newpos_[xy] to new[xy], annotations, docstring fixes
gmischler Mar 5, 2022
3a72364
revert drawing.py, after black 22.1 made up its mind
gmischler Mar 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and [PEP 440](https://www.python.org/dev/peps/pep-0440/).
- documentation on combining `borb` & `fpdf2`: [Creating a borb.pdf.document.Document from a FPDF instance](https://pyfpdf.github.io/fpdf2/ExistingPDFs.html)

### Changed
- `write()` now supports soft hyphen characters, thanks to @gmischler
- `image()` method now insert `.svg` images as PDF paths
- log level of `_substitute_page_number()` has been lowered from `INFO` to `DEBUG`

Expand Down
5 changes: 3 additions & 2 deletions docs/PageBreaks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Page breaks #

By default, `fpdf2` will automatically perform page breaks whenever a cell is rendered at the bottom of a page
with a height greater than the page bottom margin.
By default, `fpdf2` will automatically perform page breaks whenever a cell or
the text from a `write()` is rendered at the bottom of a page with a height
greater than the page bottom margin.

This behaviour can be controlled using the
[`set_auto_page_break`](fpdf/fpdf.html#fpdf.fpdf.FPDF.set_auto_page_break)
Expand Down
4 changes: 2 additions & 2 deletions docs/Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ to 1 mm (against 0.2 by default) with
[set_line_width](fpdf/fpdf.html#fpdf.fpdf.FPDF.set_line_width). Finally, we output the cell (the
last parameter to true indicates that the background must be filled).

The method used to print the paragraphs is [multi_cell](fpdf/fpdf.html#fpdf.fpdf.FPDF.multi_cell).
The method used to print the paragraphs is [multi_cell](fpdf/fpdf.html#fpdf.fpdf.FPDF.multi_cell). Text is justified by default.
Each time a line reaches the right extremity of the cell or a carriage return
character is met, a line break is issued and a new cell automatically created
under the current one. Text is justified by default.
under the current one. An automatic break is performed at the location of the nearest space or soft-hyphen (\u00ad) character before the right limit. A soft-hyphen will be replaced by a normal hyphen when triggering a line break, and ignored otherwise.

Two document properties are defined: the title
([set_title](fpdf/fpdf.html#fpdf.fpdf.FPDF.set_title)) and the author
Expand Down
4 changes: 4 additions & 0 deletions fpdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from .fpdf import (
FPDF,
X,
Y,
FPDFException,
TitleStyle,
FPDF_FONT_DIR as _FPDF_FONT_DIR,
Expand Down Expand Up @@ -39,6 +41,8 @@
"__license__",
# Classes
"FPDF",
"X",
Copy link
Member

Choose a reason for hiding this comment

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

This is really short for a class name...
It's not good if you read from fpdf import X, Y and you really don't know what are those X & Y objects!
I suggest to rename those enums XAlign & YAlign.
What do you think @gmischler?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see your point. They're not really alignments, though...
XPos & YPos ?

Copy link
Member

Choose a reason for hiding this comment

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

OK, I'm fine with that!

"Y",
"Template",
"FlexTemplate",
"TitleStyle",
Expand Down
Loading