0
def create_daily_raport(self):
elements = []
pdfmetrics.registerFont(TTFont('polishFont', 'polishFont.ttf'))
data = [['Data', 'nr zlecenia', 'oprawki', 'soczewki', 'zadatek', 'dopłata', 'cena łączna']]
data_for_table = ['1', '2', '3', '4', '5', '6', '7']
for i in range(100):
data.append(data_for_table)
t = Table(data, 7 * [inch], len(data) * [0.4*inch])
t.setStyle(TableStyle([('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
('BOX', (0,0), (-1,-1), 0.25, colors.black),
('TEXTFONT', (0, 0), (-1, -1), 'polishFont')]))
elements.append(t)
date_to_PDF = self.date_for_PDF_name()
doc = SimpleDocTemplate("Dzienny_raport_"+date_to_PDF+".pdf", pagesize=A4, rightMargin=2 * cm, leftMargin=2 * cm,
topMargin=2 * cm, bottomMargin=2 * cm)
doc.build(elements, onFirstPage=self.create_footer, onLaterPages=self.create_footer)
我在與此代碼相同的文件夾中有「polishFont.ttf」。任何建議爲什麼仍然有黑盒子而不是波蘭人的角色?reportlab表中的波蘭字符