Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,10 +67,15 @@ def register_local_fonts():
|
|
| 67 |
pdfmetrics.registerFont(TTFont(f"{font_name}-BoldItalic", str(font_path)))
|
| 68 |
pdfmetrics.registerFontFamily(font_name, normal=font_name, bold=f"{font_name}-Bold", italic=f"{font_name}-Italic", boldItalic=f"{font_name}-BoldItalic")
|
| 69 |
|
|
|
|
|
|
|
| 70 |
if "notocoloremoji-regular" in font_name.lower():
|
| 71 |
emoji_font_name = font_name
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
| 74 |
except Exception as e:
|
| 75 |
print(f"Could not register font {font_path.name}: {e}")
|
| 76 |
|
|
|
|
| 67 |
pdfmetrics.registerFont(TTFont(f"{font_name}-BoldItalic", str(font_path)))
|
| 68 |
pdfmetrics.registerFontFamily(font_name, normal=font_name, bold=f"{font_name}-Bold", italic=f"{font_name}-Italic", boldItalic=f"{font_name}-BoldItalic")
|
| 69 |
|
| 70 |
+
# Correctly identify the special color emoji font for rendering.
|
| 71 |
+
# All other fonts, including other NotoEmoji variants, will be selectable for text.
|
| 72 |
if "notocoloremoji-regular" in font_name.lower():
|
| 73 |
emoji_font_name = font_name
|
| 74 |
+
|
| 75 |
+
# Add all non-color-emoji fonts to the list for the UI.
|
| 76 |
+
if "notocoloremoji-regular" not in font_name.lower():
|
| 77 |
+
text_font_names.append(font_name)
|
| 78 |
+
|
| 79 |
except Exception as e:
|
| 80 |
print(f"Could not register font {font_path.name}: {e}")
|
| 81 |
|