diff --git a/doc/development/api/invoice.rst b/doc/development/api/invoice.rst index 69dcc222d..7b62a3727 100644 --- a/doc/development/api/invoice.rst +++ b/doc/development/api/invoice.rst @@ -84,6 +84,8 @@ convenient to you: .. automethod:: _register_fonts + .. automethod:: _register_event_fonts + .. automethod:: _on_first_page .. automethod:: _on_other_page diff --git a/src/pretix/base/invoice.py b/src/pretix/base/invoice.py index 7131620bc..55e7bb3e9 100644 --- a/src/pretix/base/invoice.py +++ b/src/pretix/base/invoice.py @@ -182,7 +182,7 @@ class BaseReportlabInvoiceRenderer(BaseInvoiceRenderer): pdfmetrics.registerFontFamily('OpenSans', normal='OpenSans', bold='OpenSansBd', italic='OpenSansIt', boldItalic='OpenSansBI') - for family, styles in get_fonts().items(): + for family, styles in get_fonts(event=self.event, pdf_support_required=True).items(): if family == self.event.settings.invoice_renderer_font: pdfmetrics.registerFont(TTFont(family, finders.find(styles['regular']['truetype']))) self.font_regular = family diff --git a/src/pretix/control/forms/event.py b/src/pretix/control/forms/event.py index a7f11d839..1f8401f48 100644 --- a/src/pretix/control/forms/event.py +++ b/src/pretix/control/forms/event.py @@ -935,6 +935,9 @@ class InvoiceSettingsForm(EventSettingsValidationMixin, SettingsForm): ) ) self.fields['invoice_generate'].choices = generate_choices + self.fields['invoice_renderer_font'].choices += [ + (a, a) for a in get_fonts(event, pdf_support_required=True).keys() + ] def contains_web_channel_validate(val): diff --git a/src/pretix/presale/style.py b/src/pretix/presale/style.py index 44189bd60..793ca7669 100644 --- a/src/pretix/presale/style.py +++ b/src/pretix/presale/style.py @@ -203,7 +203,8 @@ def regenerate_organizer_css(organizer_id: int, regenerate_events=True): register_fonts = Signal() """ -Return a dictionaries of the following structure. Paths should be relative to static root. +Return a dictionaries of the following structure. Paths should be relative to static root or an absolute URL. In the +latter case, the fonts won't be available for PDF-rendering. { "font name": { @@ -228,8 +229,10 @@ Return a dictionaries of the following structure. Paths should be relative to st register_event_fonts = EventPluginSignal() """ -Return a dictionaries of the following structure. Paths should be relative to static root. +Return a dictionaries of the following structure. Paths should be relative to static root or an absolute URL. In the +latter case, the fonts won't be available for PDF-rendering. As with all plugin signals, the ``sender`` keyword argument will contain the event. + { "font name": { "regular": {