From aa8979e373cba0a040edc486438e0d5d487598e1 Mon Sep 17 00:00:00 2001 From: chuan Date: Mon, 9 Mar 2026 20:18:15 +0800 Subject: [PATCH] use defaut offset (+1) instead of 0 --- src/gmt_support.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gmt_support.c b/src/gmt_support.c index c47af1bff30..997f84a271a 100644 --- a/src/gmt_support.c +++ b/src/gmt_support.c @@ -14917,8 +14917,8 @@ void gmt_smart_justify (struct GMT_CTRL *GMT, int just, double angle, double dx, gmt_M_unused(GMT); f = (mode == 2) ? 1.0 / M_SQRT2 : 1.0; sincosdegree (angle, &s, &c); - xx = (2 - (just%4)) * dx * f; /* Smart shift in x */ - yy = (1 - (just/4)) * dy * f; /* Smart shift in x */ + xx = (just % 4 == 2 ? 1 : (2 - (just % 4))) * dx * f; /* Smart shift in x; use +dx if horizontally centered */ + yy = (just / 4 == 1 ? 1 : (1 - (just / 4))) * dy * f; /* Smart shift in y; use +dy if vertically centered */ *x_shift += c * xx - s * yy; /* Must account for angle of label */ *y_shift += s * xx + c * yy; }