Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,9 +23,21 @@ ORIGINAL_REPO_ID = os.getenv("ORIGINAL_REPO_ID", None)
|
|
23 |
# ตั้งค่าฟอนต์
|
24 |
try:
|
25 |
pdfmetrics.registerFont(TTFont('THSarabun', 'THSarabunNew.ttf'))
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
except Exception as e:
|
28 |
-
|
29 |
|
30 |
# ฟังก์ชันแปลงวันที่เป็นภาษาไทย
|
31 |
def thai_date_time(timestamp):
|
|
|
23 |
# ตั้งค่าฟอนต์
|
24 |
try:
|
25 |
pdfmetrics.registerFont(TTFont('THSarabun', 'THSarabunNew.ttf'))
|
26 |
+
# แทนที่โค้ดเดิม
|
27 |
+
try:
|
28 |
+
# ลองใช้ฟอนต์ระบบก่อน
|
29 |
+
import platform
|
30 |
+
if platform.system() == "Linux":
|
31 |
+
font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf"
|
32 |
+
if os.path.exists(font_path):
|
33 |
+
pdfmetrics.registerFont(TTFont('THSarabunBold', font_path))
|
34 |
+
else:
|
35 |
+
# ใช้ฟอนต์ default
|
36 |
+
pass
|
37 |
+
else:
|
38 |
+
pdfmetrics.registerFont(TTFont('THSarabunBold', 'THSarabunNew-Bold.ttf'))
|
39 |
except Exception as e:
|
40 |
+
print(f"ใช้ฟอนต์ default: {e}")
|
41 |
|
42 |
# ฟังก์ชันแปลงวันที่เป็นภาษาไทย
|
43 |
def thai_date_time(timestamp):
|