Support custom fonts

This commit is contained in:
Raphael Michel
2017-08-23 13:35:47 +02:00
parent 56338be13e
commit 50ca6ee63d
5 changed files with 96 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
from django.dispatch import Signal, receiver
from django.dispatch import receiver
from django.template.loader import get_template
from django.urls import resolve
@@ -6,6 +6,9 @@ from pretix.base.signals import (
register_data_exporters, register_ticket_outputs,
)
from pretix.control.signals import html_head
from pretix.presale.style import ( # NOQA: legacy import
get_fonts, register_fonts,
)
@receiver(register_ticket_outputs, dispatch_uid="output_pdf")
@@ -30,35 +33,3 @@ def html_head_presale(sender, request=None, **kwargs):
})
else:
return ""
register_fonts = Signal()
"""
Return a dictionaries of the following structure. Paths should be relative to static root.
{
"font name": {
"regular": {
"truetype": "….ttf",
"woff": "",
"woff2": ""
},
"bold": {
...
},
"italic": {
...
},
"bolditalic": {
...
}
}
}
"""
def get_fonts():
f = {}
for recv, value in register_fonts.send(0):
f.update(value)
return f