diff --git a/butils.py b/butils.py index 404ae9a..b1462f7 100644 --- a/butils.py +++ b/butils.py @@ -595,9 +595,19 @@ def set_text_on_curve(text_properties): glyph_advance = (-1 * glyph.bound_box[0][0] + glyph.bound_box[4][0]) * scalor + text_properties.letter_spacing + # now we need to compensate for curvature + # otherwise letters will be closer together the curvier the bezier is + # this could be done more efficiently, but whatever + previous_location = calc_point_on_bezier_curve(mom, advance, False) + new_location = calc_point_on_bezier_curve(mom, advance + glyph_advance, False) + curve_compensation = 0 + while (previous_location - new_location).length < glyph_advance: + curve_compensation = curve_compensation + glyph_advance * 0.1 + new_location = calc_point_on_bezier_curve(mom, advance + glyph_advance + curve_compensation, False) + ob.scale = (scalor, scalor, scalor) - advance = advance + glyph_advance + advance = advance + glyph_advance + curve_compensation if regenerate: mom.users_collection[0].objects.link(ob)