Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Update most fonts to subset to reduce distribution size.

### Removed

- Unused python script for generating invoice PDF (`invoice.py`)
Expand Down
Binary file added bulkinvoicer/fonts/NotoSans-Bold.subset.ttf
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSans-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSans-BoldItalic.ttf
Binary file not shown.
Binary file added bulkinvoicer/fonts/NotoSans-Italic.subset.ttf
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSans-Italic.ttf
Binary file not shown.
Binary file added bulkinvoicer/fonts/NotoSansMono-Bold.subset.ttf
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSansMono-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSansMono-Regular.ttf
Binary file not shown.
Binary file added bulkinvoicer/fonts/NotoSerif-Bold.subset.ttf
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSerif-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSerif-BoldItalic.ttf
Binary file not shown.
Binary file added bulkinvoicer/fonts/NotoSerif-Italic.subset.ttf
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSerif-Italic.ttf
Binary file not shown.
Binary file added bulkinvoicer/fonts/NotoSerif-Regular.subset.ttf
Binary file not shown.
Binary file removed bulkinvoicer/fonts/NotoSerif-Regular.ttf
Binary file not shown.
40 changes: 24 additions & 16 deletions bulkinvoicer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,30 @@ def __init__(

fonts_folder = Path(__file__).parent / "fonts"

self.add_font("Noto Sans", "", fonts_folder / "NotoSans-Regular.ttf")
self.add_font("Noto Sans", "B", fonts_folder / "NotoSans-Bold.ttf")
self.add_font("Noto Sans", "I", fonts_folder / "NotoSans-Italic.ttf")
self.add_font("Noto Sans", "BI", fonts_folder / "NotoSans-BoldItalic.ttf")

self.add_font("Noto Sans Mono", "", fonts_folder / "NotoSansMono-Regular.ttf")
self.add_font("Noto Sans Mono", "B", fonts_folder / "NotoSansMono-Bold.ttf")

self.add_font("Noto Serif", "", fonts_folder / "NotoSerif-Regular.ttf")
self.add_font("Noto Serif", "B", fonts_folder / "NotoSerif-Bold.ttf")
self.add_font("Noto Serif", "I", fonts_folder / "NotoSerif-Italic.ttf")
self.add_font("Noto Serif", "BI", fonts_folder / "NotoSerif-BoldItalic.ttf")

self.header_font = FontFace(family="Noto Sans")
self.regular_font = FontFace(family="Noto Serif")
self.numbers_font = FontFace(family="Noto Sans Mono")
self.add_font("NotoSans", "", fonts_folder / "NotoSans-Regular.ttf")
self.add_font("NotoSans", "B", fonts_folder / "NotoSans-Bold.subset.ttf")
self.add_font("NotoSans", "I", fonts_folder / "NotoSans-Italic.subset.ttf")
self.add_font("NotoSans", "BI", fonts_folder / "NotoSans-BoldItalic.subset.ttf")

self.add_font(
"NotoSansMono", "", fonts_folder / "NotoSansMono-Regular.subset.ttf"
)
self.add_font(
"NotoSansMono", "B", fonts_folder / "NotoSansMono-Bold.subset.ttf"
)

self.add_font("NotoSerif", "", fonts_folder / "NotoSerif-Regular.subset.ttf")
self.add_font("NotoSerif", "B", fonts_folder / "NotoSerif-Bold.subset.ttf")
self.add_font("NotoSerif", "I", fonts_folder / "NotoSerif-Italic.subset.ttf")
self.add_font(
"NotoSerif", "BI", fonts_folder / "NotoSerif-BoldItalic.subset.ttf"
)

self.set_fallback_fonts(["NotoSans"], exact_match=False)

self.header_font = FontFace(family="NotoSans")
self.regular_font = FontFace(family="NotoSerif")
self.numbers_font = FontFace(family="NotoSansMono")

self.set_text_shaping(True)

Expand Down