From 5cb411c2b44e45f6ee95ab4aeb00efbd3c60f1cc Mon Sep 17 00:00:00 2001 From: Rodrigo Ferreira Rodrigues Date: Fri, 4 Oct 2019 16:20:58 -0300 Subject: [PATCH] =?UTF-8?q?[ADD]=20Adicionado=20importa=C3=A7=C3=A3o=20da?= =?UTF-8?q?=20fonte=20no=20init=20da=20classe=20Danfce=20para=20impress?= =?UTF-8?q?=C3=A3o=20do=20cupom=20fiscal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pytrustnfe/nfe/danfce.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pytrustnfe/nfe/danfce.py b/pytrustnfe/nfe/danfce.py index 9e64c24..0029418 100644 --- a/pytrustnfe/nfe/danfce.py +++ b/pytrustnfe/nfe/danfce.py @@ -3,6 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import re +import os from textwrap import wrap from io import BytesIO @@ -15,6 +16,8 @@ from reportlab.graphics.shapes import Drawing from reportlab.platypus import Table, TableStyle, Paragraph, Image from reportlab.lib.enums import TA_CENTER from reportlab.lib.styles import ParagraphStyle +from reportlab.pdfbase import pdfmetrics +from reportlab.pdfbase.ttfonts import TTFont def format_cnpj_cpf(value): @@ -74,6 +77,14 @@ class danfce(object): def __init__(self, list_xml, logo=None, timezone=None): + path = os.path.join(os.path.dirname(__file__), 'fonts') + pdfmetrics.registerFont( + TTFont('NimbusSanL-Regu', + os.path.join(path, 'NimbusSanL Regular.ttf'))) + pdfmetrics.registerFont( + TTFont('NimbusSanL-Bold', + os.path.join(path, 'NimbusSanL Bold.ttf'))) + self.current_font_size = 7 self.current_font_name = 'NimbusSanL-Regu'