Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,13 +9,12 @@ from urllib.request import urlretrieve
|
|
9 |
import os
|
10 |
|
11 |
FONT_DIR = "/tmp/fonts"
|
12 |
-
FONT_PATH = os.path.join(FONT_DIR, "
|
13 |
|
14 |
-
# Create font dir and download font only if needed
|
15 |
os.makedirs(FONT_DIR, exist_ok=True)
|
16 |
if not os.path.exists(FONT_PATH):
|
17 |
urlretrieve(
|
18 |
-
"https://github.com/
|
19 |
FONT_PATH
|
20 |
)
|
21 |
|
@@ -35,8 +34,8 @@ def generate_pdf_from_chat(chat_history):
|
|
35 |
pdf.add_page()
|
36 |
|
37 |
# Register Unicode font
|
38 |
-
pdf.add_font("
|
39 |
-
pdf.set_font("
|
40 |
pdf.set_auto_page_break(auto=True, margin=15)
|
41 |
|
42 |
# Add the text safely
|
|
|
9 |
import os
|
10 |
|
11 |
FONT_DIR = "/tmp/fonts"
|
12 |
+
FONT_PATH = os.path.join(FONT_DIR, "NotoSans-Regular.ttf")
|
13 |
|
|
|
14 |
os.makedirs(FONT_DIR, exist_ok=True)
|
15 |
if not os.path.exists(FONT_PATH):
|
16 |
urlretrieve(
|
17 |
+
"https://github.com/google/fonts/raw/main/ofl/notosans/NotoSans-Regular.ttf",
|
18 |
FONT_PATH
|
19 |
)
|
20 |
|
|
|
34 |
pdf.add_page()
|
35 |
|
36 |
# Register Unicode font
|
37 |
+
pdf.add_font("NotoSans", "", FONT_PATH, uni=True)
|
38 |
+
pdf.set_font("NotoSans", size=12)
|
39 |
pdf.set_auto_page_break(auto=True, margin=15)
|
40 |
|
41 |
# Add the text safely
|