forked from CGM_Public/pretix_original
Invoices: Add support for event-fonts
This commit is contained in:
@@ -84,6 +84,8 @@ convenient to you:
|
||||
|
||||
.. automethod:: _register_fonts
|
||||
|
||||
.. automethod:: _register_event_fonts
|
||||
|
||||
.. automethod:: _on_first_page
|
||||
|
||||
.. automethod:: _on_other_page
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user