forked from CGM_Public/pretix_original
PDF: Check for allowed font name before adding modifiers to the name
This commit is contained in:
@@ -935,10 +935,6 @@ class Renderer:
|
|||||||
|
|
||||||
def _draw_textarea(self, canvas: Canvas, op: OrderPosition, order: Order, o: dict):
|
def _draw_textarea(self, canvas: Canvas, op: OrderPosition, order: Order, o: dict):
|
||||||
font = o['fontfamily']
|
font = o['fontfamily']
|
||||||
if o['bold']:
|
|
||||||
font += ' B'
|
|
||||||
if o['italic']:
|
|
||||||
font += ' I'
|
|
||||||
|
|
||||||
# Since pdfmetrics.registerFont is global, we want to make sure that no one tries to sneak in a font, they
|
# Since pdfmetrics.registerFont is global, we want to make sure that no one tries to sneak in a font, they
|
||||||
# should not have access to.
|
# should not have access to.
|
||||||
@@ -946,6 +942,11 @@ class Renderer:
|
|||||||
logger.warning(f'Unauthorized use of font "{font}"')
|
logger.warning(f'Unauthorized use of font "{font}"')
|
||||||
font = 'Open Sans'
|
font = 'Open Sans'
|
||||||
|
|
||||||
|
if o['bold']:
|
||||||
|
font += ' B'
|
||||||
|
if o['italic']:
|
||||||
|
font += ' I'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ad = getAscentDescent(font, float(o['fontsize']))
|
ad = getAscentDescent(font, float(o['fontsize']))
|
||||||
except KeyError: # font not known, fall back
|
except KeyError: # font not known, fall back
|
||||||
|
|||||||
Reference in New Issue
Block a user