From 0e7ea5ca80ad8cfd61a3591b2dea303df6c8238c Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Fri, 16 Feb 2024 14:05:27 +0100 Subject: Change fonts used in the chart --- forms/colour_chart.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'forms') diff --git a/forms/colour_chart.py b/forms/colour_chart.py index 30d97d7..efcd7d0 100755 --- a/forms/colour_chart.py +++ b/forms/colour_chart.py @@ -44,13 +44,26 @@ class Chart: def write_pdf(self, fname): pdf = fpdf.FPDF(format="A5") + pdf.add_font( + family="FreeSans", + fname="/usr/share/fonts/opentype/freefont/FreeSans.otf", + ) + pdf.add_font( + family="FreeSans", + style="B", + fname="/usr/share/fonts/opentype/freefont/FreeSansBold.otf", + ) + pdf.add_font( + family="FreeSerif", + fname="/usr/share/fonts/opentype/freefont/FreeSerif.otf", + ) for p_num, page in enumerate(self.get_arranged_cells()): pdf.add_page() - pdf.set_font("helvetica", size=12) + pdf.set_font("FreeSerif", size=12) pdf.cell(64, 8, self.data["title"], align="C") pdf.ln() - pdf.set_font("helvetica", "B", 12) + pdf.set_font("FreeSans", "B", 12) for j in range(self.COLUMNS): pdf.cell(16, 8, str(j + p_num * self.COLUMNS),) pdf.cell(16, 8, "") -- cgit v1.2.3