def set_fonts(self):
 font_set = current.deployment_settings.get_pdf_export_font()
 if font_set:
  try:
   font_name = font_set[0]
   font_name_bold = font_set[1]
   folder = current.request.folder
   pdfmetrics.registerFont(TTFont(font_name, os.path.join(folder, 'static', 'fonts', ('%s.ttf' % font_name))))
   pdfmetrics.registerFont(TTFont(font_name_bold, os.path.join(folder, 'static', 'fonts', ('%s.ttf' % font_name_bold))))
  except:
   current.log.error(('%s Font not found: Please install it to see the correct fonts in PDF exports' % font_set[0]))
   self.font_name = 'Helvetica'
   self.font_name_bold = 'Helvetica-Bold'
  else:
   self.font_name = font_name
   self.font_name_bold = font_name_bold
 else:
  self.font_name = 'Helvetica'
  self.font_name_bold = 'Helvetica-Bold'

def set_fonts ( self ) : font_set = current . deployment_settings . get_pdf_export_font ( ) if font_set : try : font_name = font_set [ 0 ] font_name_bold = font_set [ 1 ] folder = current . request . folder pdfmetrics . registerFont ( TTFont ( font_name , os . path . join ( folder , 'static' , 'fonts' , ( '%s.ttf' % font_name ) ) ) ) pdfmetrics . registerFont ( TTFont ( font_name_bold , os . path . join ( folder , 'static' , 'fonts' , ( '%s.ttf' % font_name_bold ) ) ) ) except : current . log . error ( ( '%s Font not found: Please install it to see the correct fonts in PDF exports' % font_set [ 0 ] ) ) self . font_name = 'Helvetica' self . font_name_bold = 'Helvetica-Bold' else : self . font_name = font_name self . font_name_bold = font_name_bold else : self . font_name = 'Helvetica' self . font_name_bold = 'Helvetica-Bold'
dry helper function for all classes which use pdf to set the appropriate fonts .