Invoices: Support font choice and Arabic text

This commit is contained in:
Raphael Michel
2023-05-22 10:52:46 +02:00
parent e0524f2a03
commit d6f0615712
6 changed files with 157 additions and 81 deletions

View File

@@ -96,6 +96,18 @@ def primary_font_kwargs():
}
def invoice_font_kwargs():
from pretix.presale.style import get_fonts
choices = [('Open Sans', 'Open Sans')]
choices += sorted([
(a, a) for a, v in get_fonts().items()
], key=lambda a: a[0])
return {
'choices': choices,
}
def restricted_plugin_kwargs():
from pretix.base.plugins import get_all_plugins
@@ -644,6 +656,19 @@ DEFAULTS = {
help_text=_("Only respected by some invoice renderers."),
)
},
'invoice_renderer_font': {
'default': 'Open Sans',
'type': str,
'form_class': forms.ChoiceField,
'serializer_class': serializers.ChoiceField,
'serializer_kwargs': lambda: dict(**invoice_font_kwargs()),
'form_kwargs': lambda: dict(
label=_('Font'),
help_text=_("Only respected by some invoice renderers."),
required=True,
**invoice_font_kwargs()
),
},
'invoice_renderer': {
'default': 'classic', # default for new events is 'modern1'
'type': str,