@@ -266,19 +266,24 @@ function horizontal_hairpin_adjustment(left_or_right, hairpin, region_settings,
266266 if # expression_list > 0 then
267267 local dyn_exp = expression_list [1 ][2 ]
268268 local dyn_def = dyn_exp :CreateTextExpressionDef ()
269- local dyn_width = expression_list [1 ][1 ] -- the full value is needed for finale.EXPRJUSTIFY_LEFT
269+ local full_dyn_width = expression_list [1 ][1 ]
270+ local start_dyn_width = full_dyn_width -- the full value is needed for finale.EXPRJUSTIFY_LEFT
271+ local end_dyn_width = 0
270272 if finale .EXPRJUSTIFY_CENTER == dyn_def .HorizontalJustification then
271- dyn_width = dyn_width / 2
273+ start_dyn_width = full_dyn_width / 2
274+ end_dyn_width = full_dyn_width / 2
272275 elseif finale .EXPRJUSTIFY_RIGHT == dyn_def .HorizontalJustification then
273- dyn_width = 0
276+ start_dyn_width = 0
277+ end_dyn_width = full_dyn_width
274278 end
275279 local cell_metrics = finale .FCCellMetrics ()
276280 cell_metrics :LoadAtCell (finale .FCCell (dyn_exp .Measure , dyn_exp .Staff ))
277281 local staff_percent = cell_metrics .StaffScaling / cell_metrics .SystemScaling
278- dyn_width = dyn_width * staff_percent
282+ start_dyn_width = start_dyn_width * staff_percent
283+ end_dyn_width = end_dyn_width * staff_percent
279284 local handle_offset_from_edupos = expression .calc_handle_offset_for_smart_shape (dyn_exp )
280285 if left_or_right == " left" then
281- local total_x = dyn_width + config .left_dynamic_cushion + handle_offset_from_edupos
286+ local total_x = start_dyn_width + config .left_dynamic_cushion + handle_offset_from_edupos
282287 the_seg :SetEndpointOffsetX (total_x )
283288 elseif left_or_right == " right" then
284289 local next_measure_gap = 0
@@ -292,7 +297,7 @@ function horizontal_hairpin_adjustment(left_or_right, hairpin, region_settings,
292297 end
293298 end
294299 cushion_bool = false
295- local total_x = (0 - dyn_width ) + config .right_dynamic_cushion + next_measure_gap + handle_offset_from_edupos
300+ local total_x = (0 - end_dyn_width ) + config .right_dynamic_cushion + next_measure_gap + handle_offset_from_edupos
296301 the_seg :SetEndpointOffsetX (total_x )
297302 end
298303 end
0 commit comments