PDF: meilleure gestion d'erreur si police invalide

This commit is contained in:
Emmanuel Viennet 2023-02-14 17:28:25 +01:00
parent c5b2f89de8
commit 88b06f11d0
2 changed files with 12 additions and 4 deletions

View File

@ -320,9 +320,17 @@ class ScoDocPageTemplate(PageTemplate):
def draw_footer(self, canv, content):
"""Print the footer"""
canv.setFont(
self.preferences["SCOLAR_FONT"], self.preferences["SCOLAR_FONT_SIZE_FOOT"]
)
try:
canv.setFont(
self.preferences["SCOLAR_FONT"],
self.preferences["SCOLAR_FONT_SIZE_FOOT"],
)
except KeyError as exc:
raise ScoValueError(
f"""Police invalide dans pied de page pdf: {
self.preferences['SCOLAR_FONT']
} (taille {self.preferences['SCOLAR_FONT_SIZE_FOOT']})"""
) from exc
canv.drawString(
self.preferences["pdf_footer_x"] * mm,
self.preferences["pdf_footer_y"] * mm,

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.4.43"
SCOVERSION = "9.4.44"
SCONAME = "ScoDoc"