mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Performance: Do not load the same TTF font multiple times
This commit is contained in:
@@ -568,6 +568,8 @@ class Renderer:
|
||||
|
||||
@classmethod
|
||||
def _register_fonts(cls):
|
||||
if hasattr(cls, '_fonts_registered'):
|
||||
return
|
||||
pdfmetrics.registerFont(TTFont('Open Sans', finders.find('fonts/OpenSans-Regular.ttf')))
|
||||
pdfmetrics.registerFont(TTFont('Open Sans I', finders.find('fonts/OpenSans-Italic.ttf')))
|
||||
pdfmetrics.registerFont(TTFont('Open Sans B', finders.find('fonts/OpenSans-Bold.ttf')))
|
||||
@@ -582,6 +584,8 @@ class Renderer:
|
||||
if 'bolditalic' in styles:
|
||||
pdfmetrics.registerFont(TTFont(family + ' B I', finders.find(styles['bolditalic']['truetype'])))
|
||||
|
||||
cls._fonts_registered = True
|
||||
|
||||
def _draw_poweredby(self, canvas: Canvas, op: OrderPosition, o: dict):
|
||||
content = o.get('content', 'dark')
|
||||
if content not in ('dark', 'white'):
|
||||
|
||||
Reference in New Issue
Block a user