Skip to content

Commit

Permalink
release v2.1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisschellekens committed Aug 3, 2024
1 parent ff03f8b commit b7541a0
Show file tree
Hide file tree
Showing 63 changed files with 54 additions and 19 deletions.
2 changes: 1 addition & 1 deletion borb/license/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ def get_version() -> str:
This function returns the current borb version
:return: the current borb version
"""
return "2.1.24"
return "2.1.25"
4 changes: 3 additions & 1 deletion borb/pdf/canvas/font/google_true_type_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def _download_google_font(font_name: str) -> pathlib.Path:
), f"Unable to find URL for font {font_name}"

# download to temporary file
temp_font_file: pathlib.Path = pathlib.Path(tempfile.NamedTemporaryFile(suffix=".ttf").name)
temp_font_file: pathlib.Path = pathlib.Path(
tempfile.NamedTemporaryFile(suffix=".ttf").name
)
with open(temp_font_file, "wb") as fh:
fh.write(requests.get(true_type_font_file_url).content)

Expand Down
2 changes: 1 addition & 1 deletion borb/pdf/canvas/layout/text/paragraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _get_content_box(self, available_space: Rectangle) -> Rectangle:
# When using justification,
# it is customary to treat the last line of a paragraph separately by simply left or right aligning it,
# depending on the language direction.
if self._text_alignment == Alignment.JUSTIFIED and len(lines_of_text) > 1:
if self._text_alignment == Alignment.JUSTIFIED:
lines_of_text[-1]._text_alignment = Alignment.LEFT

# determine line height
Expand Down
16 changes: 1 addition & 15 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@

# :mega: borb release notes

This release features `GoogleTrueTypeFont` which enables users to access the Google Font API,
to directly use a `TrueTypeFont` in `borb` by specifying its name.

Tests have been added for this feature:

- `test_add_paragraphs_using_jacquard_12`
- `test_add_paragraphs_using_pacifico`
- `test_add_paragraphs_using_shadows_into_light`

Some tests have been added to guard code quality:

- `TestCodeFilesContainSortedMethods`
- `TestCodeFilesContainVisibilityComments`
- `TestCodeFilesDoNotContainNumbersInMethods`
- `TestCodeFilesNeverUseKeyring`
This release features a minor bugfix in `Paragraph` related to text-alignment `JUSTIFIED`.
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cryptography>=41.0.1
fonttools>=4.38.0
gTTS>=2.4.0
keyring>=24.3.0
lxml>=4.9.2
markdown-it-py>=3.0.0
matplotlib>=3.8.2
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import random

from borb.pdf import PDF
from borb.pdf import Alignment
from borb.pdf import Lipsum
from borb.pdf import Paragraph
from borb.pdf import SingleColumnLayout
from borb.pdf import Page
from borb.pdf import Document

from tests.test_case import TestCase


class TestAddParagraphAlignmentJustified(TestCase):
def test_add_paragraph_alignment_justified(self):

pdf = Document()
page = Page()
pdf.add_page(page)
layout = SingleColumnLayout(page)
layout.add(
self.get_test_header(
test_description="This test adds a Paragraph to the PDF. The Paragraph is aligned JUSTIFIED."
)
)

# mult-line paragraph
random.seed(0)
layout.add(
Paragraph(
Lipsum.generate_lipsum_text(5), text_alignment=Alignment.JUSTIFIED
)
)

# single-line paragraph
layout.add(
Paragraph(
Lipsum.generate_lipsum_text(1), text_alignment=Alignment.JUSTIFIED
)
)

# store
with open(self.get_first_output_file(), "wb") as fh:
PDF.dumps(fh, pdf)

# compare
self.compare_visually_to_ground_truth(self.get_first_output_file())
self.check_pdf_using_validator(self.get_first_output_file())
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified tests/toolkit/table/artifacts_test_detect_table/input_000.pdf
Binary file not shown.
Binary file modified tests/toolkit/table/artifacts_test_detect_table/input_001.pdf
Binary file not shown.
Binary file modified tests/toolkit/table/artifacts_test_detect_table/input_002.pdf
Binary file not shown.
Binary file modified tests/toolkit/table/artifacts_test_detect_table/input_003.pdf
Binary file not shown.
Binary file modified tests/toolkit/table/artifacts_test_detect_table/input_004.pdf
Binary file not shown.
Binary file modified tests/toolkit/table/artifacts_test_detect_table/input_005.pdf
Binary file not shown.
Binary file modified tests/toolkit/table/artifacts_test_detect_table/input_006.pdf
Binary file not shown.

0 comments on commit b7541a0

Please sign in to comment.