load specific font in memory

This commit is contained in:
jrkb 2024-08-28 17:25:06 +02:00
parent 40e97aaf9e
commit cd1af39985
2 changed files with 26 additions and 3 deletions

View file

@ -695,9 +695,14 @@ def set_text_on_curve(text_properties, recursive=True):
is_command = False
previous_spline_index = -1
for i, c in enumerate(text_properties.text):
face = Font.fonts[text_properties.font_name].faces[text_properties.face_name]
scalor = face.unit_factor * text_properties.font_size
if c == '\\':
is_command = True
continue
if c == ' ':
advance = advance + scalor
continue
is_newline = False
if is_command:
if c == 'n':
@ -767,8 +772,6 @@ def set_text_on_curve(text_properties, recursive=True):
ob.rotation_quaternion = q
# ob.rotation_quaternion = (mom.matrix_world @ q.to_matrix().to_4x4()).to_quaternion()
face = Font.fonts[text_properties.font_name].faces[text_properties.face_name]
scalor = face.unit_factor * text_properties.font_size
glyph_advance = get_glyph_advance(glyph) * scalor + text_properties.letter_spacing
@ -776,7 +779,7 @@ def set_text_on_curve(text_properties, recursive=True):
# otherwise letters will be closer together the curvier the bezier is
# this could be done more efficiently, but whatever
curve_compensation = 0
if distribution_type == 'CALCULATE' and not is_newline:
if distribution_type == 'CALCULATE' and (not is_newline or spline_index == 0): # TODO: fix newline hack
if text_properties.compensate_curvature and glyph_advance > 0:
previous_location, psi = calc_point_on_bezier_curve(mom, advance, False, True)
new_location, si = calc_point_on_bezier_curve(mom, advance + glyph_advance, False, True)