From 323183b041e73642f95e6dd4111c8a2e3ac707c5 Mon Sep 17 00:00:00 2001 From: Robert Patterson Date: Mon, 30 Mar 2026 15:10:32 -0500 Subject: [PATCH] handle expression width oppositely for endpoint than startpoint --- src/standalone_hairpin_adjustment.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/standalone_hairpin_adjustment.lua b/src/standalone_hairpin_adjustment.lua index 86c2e9af..aa9f7f6a 100644 --- a/src/standalone_hairpin_adjustment.lua +++ b/src/standalone_hairpin_adjustment.lua @@ -266,19 +266,24 @@ function horizontal_hairpin_adjustment(left_or_right, hairpin, region_settings, if #expression_list > 0 then local dyn_exp = expression_list[1][2] local dyn_def = dyn_exp:CreateTextExpressionDef() - local dyn_width = expression_list[1][1] -- the full value is needed for finale.EXPRJUSTIFY_LEFT + local full_dyn_width = expression_list[1][1] + local start_dyn_width = full_dyn_width -- the full value is needed for finale.EXPRJUSTIFY_LEFT + local end_dyn_width = 0 if finale.EXPRJUSTIFY_CENTER == dyn_def.HorizontalJustification then - dyn_width = dyn_width / 2 + start_dyn_width = full_dyn_width / 2 + end_dyn_width = full_dyn_width / 2 elseif finale.EXPRJUSTIFY_RIGHT == dyn_def.HorizontalJustification then - dyn_width = 0 + start_dyn_width = 0 + end_dyn_width = full_dyn_width end local cell_metrics = finale.FCCellMetrics() cell_metrics:LoadAtCell(finale.FCCell(dyn_exp.Measure, dyn_exp.Staff)) local staff_percent = cell_metrics.StaffScaling / cell_metrics.SystemScaling - dyn_width = dyn_width * staff_percent + start_dyn_width = start_dyn_width * staff_percent + end_dyn_width = end_dyn_width * staff_percent local handle_offset_from_edupos = expression.calc_handle_offset_for_smart_shape(dyn_exp) if left_or_right == "left" then - local total_x = dyn_width + config.left_dynamic_cushion + handle_offset_from_edupos + local total_x = start_dyn_width + config.left_dynamic_cushion + handle_offset_from_edupos the_seg:SetEndpointOffsetX(total_x) elseif left_or_right == "right" then local next_measure_gap = 0 @@ -292,7 +297,7 @@ function horizontal_hairpin_adjustment(left_or_right, hairpin, region_settings, end end cushion_bool = false - local total_x = (0 - dyn_width) + config.right_dynamic_cushion + next_measure_gap + handle_offset_from_edupos + local total_x = (0 - end_dyn_width) + config.right_dynamic_cushion + next_measure_gap + handle_offset_from_edupos the_seg:SetEndpointOffsetX(total_x) end end