Spaces:
Running on Zero
Running on Zero
bartwisch commited on
Commit ·
d96a7cf
1
Parent(s): 14c6db0
chore: prefer DejaVuSans from Linux path for overlay font
Browse files- src/image_processor.py +7 -1
src/image_processor.py
CHANGED
|
@@ -167,7 +167,13 @@ class ImageProcessor:
|
|
| 167 |
|
| 168 |
def _load_font(self, fontsize: int):
|
| 169 |
"""Helper to load a font with fallback"""
|
| 170 |
-
font_names = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
for name in font_names:
|
| 172 |
try:
|
| 173 |
return ImageFont.truetype(name, fontsize)
|
|
|
|
| 167 |
|
| 168 |
def _load_font(self, fontsize: int):
|
| 169 |
"""Helper to load a font with fallback"""
|
| 170 |
+
font_names = [
|
| 171 |
+
"Arial.ttf", # generic name (Windows/macOS dev)
|
| 172 |
+
"/System/Library/Fonts/Helvetica.ttc", # macOS
|
| 173 |
+
"/System/Library/Fonts/Supplemental/Arial.ttf", # macOS supplemental
|
| 174 |
+
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", # common Linux path (HF Spaces)
|
| 175 |
+
"DejaVuSans.ttf", # fallback by font name
|
| 176 |
+
]
|
| 177 |
for name in font_names:
|
| 178 |
try:
|
| 179 |
return ImageFont.truetype(name, fontsize)
|