Spaces:
Build error
Build error
solved github issue #142, changed font
Browse files- NotoSans-Bold.ttf +0 -0
- NotoSans-Regular.ttf +0 -0
- Quattrocento-Bold.ttf +0 -0
- Quattrocento-Regular.ttf +0 -0
- app.py +2 -2
- test/test_lithuanian.py +10 -0
NotoSans-Bold.ttf
ADDED
|
Binary file (455 kB). View file
|
|
|
NotoSans-Regular.ttf
ADDED
|
Binary file (455 kB). View file
|
|
|
Quattrocento-Bold.ttf
DELETED
|
Binary file (154 kB)
|
|
|
Quattrocento-Regular.ttf
DELETED
|
Binary file (148 kB)
|
|
|
app.py
CHANGED
|
@@ -32,8 +32,8 @@ def generate_certificate(certificate_path: str, name: str, profile_url: str):
|
|
| 32 |
im = Image.open(certificate_path)
|
| 33 |
d = ImageDraw.Draw(im)
|
| 34 |
|
| 35 |
-
name_font = ImageFont.truetype("
|
| 36 |
-
date_font = ImageFont.truetype("
|
| 37 |
|
| 38 |
# Capitalize first letter of each name
|
| 39 |
name = name.title()
|
|
|
|
| 32 |
im = Image.open(certificate_path)
|
| 33 |
d = ImageDraw.Draw(im)
|
| 34 |
|
| 35 |
+
name_font = ImageFont.truetype("NotoSans-Regular.ttf", 100)
|
| 36 |
+
date_font = ImageFont.truetype("NotoSans-Regular.ttf", 48)
|
| 37 |
|
| 38 |
# Capitalize first letter of each name
|
| 39 |
name = name.title()
|
test/test_lithuanian.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PIL import Image, ImageDraw, ImageFont
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
font_path = os.path.join(os.path.dirname(__file__), "..", "NotoSans-Regular.ttf")
|
| 5 |
+
font = ImageFont.truetype(font_path, 20)
|
| 6 |
+
test_text = "Lithuanian letters: Ė ė Ą ą Č č abcdef"
|
| 7 |
+
img = Image.new("RGB", (600, 100), "white")
|
| 8 |
+
draw = ImageDraw.Draw(img)
|
| 9 |
+
draw.text((10, 10), test_text, font=font, fill="black")
|
| 10 |
+
img.show()
|