mirror of
https://github.com/pretix/pretix.git
synced 2026-08-04 09:47:50 +00:00
Invoices: Add support for event-fonts
This commit is contained in:
@@ -84,6 +84,8 @@ convenient to you:
|
|||||||
|
|
||||||
.. automethod:: _register_fonts
|
.. automethod:: _register_fonts
|
||||||
|
|
||||||
|
.. automethod:: _register_event_fonts
|
||||||
|
|
||||||
.. automethod:: _on_first_page
|
.. automethod:: _on_first_page
|
||||||
|
|
||||||
.. automethod:: _on_other_page
|
.. automethod:: _on_other_page
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class BaseReportlabInvoiceRenderer(BaseInvoiceRenderer):
|
|||||||
pdfmetrics.registerFontFamily('OpenSans', normal='OpenSans', bold='OpenSansBd',
|
pdfmetrics.registerFontFamily('OpenSans', normal='OpenSans', bold='OpenSansBd',
|
||||||
italic='OpenSansIt', boldItalic='OpenSansBI')
|
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:
|
if family == self.event.settings.invoice_renderer_font:
|
||||||
pdfmetrics.registerFont(TTFont(family, finders.find(styles['regular']['truetype'])))
|
pdfmetrics.registerFont(TTFont(family, finders.find(styles['regular']['truetype'])))
|
||||||
self.font_regular = family
|
self.font_regular = family
|
||||||
|
|||||||
@@ -935,6 +935,9 @@ class InvoiceSettingsForm(EventSettingsValidationMixin, SettingsForm):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.fields['invoice_generate'].choices = generate_choices
|
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):
|
def contains_web_channel_validate(val):
|
||||||
|
|||||||
@@ -203,7 +203,8 @@ def regenerate_organizer_css(organizer_id: int, regenerate_events=True):
|
|||||||
|
|
||||||
register_fonts = Signal()
|
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": {
|
"font name": {
|
||||||
@@ -228,8 +229,10 @@ Return a dictionaries of the following structure. Paths should be relative to st
|
|||||||
|
|
||||||
register_event_fonts = EventPluginSignal()
|
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.
|
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||||
|
|
||||||
{
|
{
|
||||||
"font name": {
|
"font name": {
|
||||||
"regular": {
|
"regular": {
|
||||||
|
|||||||
Reference in New Issue
Block a user