Spaces:
Sleeping
Sleeping
Update chroma/chroma/utility/chroma.py
Browse files
chroma/chroma/utility/chroma.py
CHANGED
@@ -30,7 +30,9 @@ from chroma.layers.structure import backbone
|
|
30 |
def letter_to_point_cloud(
|
31 |
letter="G",
|
32 |
width_pixels=35,
|
33 |
-
font =
|
|
|
|
|
34 |
depth_ratio=0.15,
|
35 |
fontsize_ratio=1.2,
|
36 |
stroke_width=1,
|
@@ -41,7 +43,7 @@ def letter_to_point_cloud(
|
|
41 |
depth = int(depth_ratio * width_pixels)
|
42 |
fontsize = int(fontsize_ratio * width_pixels)
|
43 |
|
44 |
-
font = ImageFont.
|
45 |
ascent, descent = font.getmetrics()
|
46 |
text_width = font.getmask(letter).getbbox()[2]
|
47 |
text_height = font.getmask(letter).getbbox()[3] + descent
|
|
|
30 |
def letter_to_point_cloud(
|
31 |
letter="G",
|
32 |
width_pixels=35,
|
33 |
+
font = os.path.join(
|
34 |
+
os.path.dirname(chroma.__path__[0]), "./assets/LiberationSans-Regular.ttf"
|
35 |
+
),
|
36 |
depth_ratio=0.15,
|
37 |
fontsize_ratio=1.2,
|
38 |
stroke_width=1,
|
|
|
43 |
depth = int(depth_ratio * width_pixels)
|
44 |
fontsize = int(fontsize_ratio * width_pixels)
|
45 |
|
46 |
+
font = ImageFont.truetype(font,fontsize)
|
47 |
ascent, descent = font.getmetrics()
|
48 |
text_width = font.getmask(letter).getbbox()[2]
|
49 |
text_height = font.getmask(letter).getbbox()[3] + descent
|