From 7b10e39383599234fbae12cc9b68b36a716badc4 Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Sun, 9 Aug 2026 15:10:06 -0300 Subject: [PATCH 1/4] update plot --- src/gmt_plot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gmt_plot.c b/src/gmt_plot.c index 3825e23ec5d..c9ecf6e81c6 100644 --- a/src/gmt_plot.c +++ b/src/gmt_plot.c @@ -7023,6 +7023,12 @@ unsigned int gmt_setfont (struct GMT_CTRL *GMT, struct GMT_FONT *F) { outline = 2; /* Indicates outline font is needed for filling but will not be stroked */ } else { /* Regular, solid text fill is set via stroke color */ + if (F->fill.rgb[3] > 0.0) { + /* Honor transparency embedded in the font color (e.g. red@50), which + * PSL_setcolor does not apply on its own (unlike PSL_setfill/PSL_setline). */ + PSL_command (GMT->PSL, "%.12g %.12g /%s PSL_transp\n", + 1.0 - F->fill.rgb[3], 1.0 - F->fill.rgb[3], GMT->current.setting.ps_transpmode); + } PSL_setcolor (GMT->PSL, F->fill.rgb, PSL_IS_FONT); outline = 0; /* Indicates we will fill text using "show" which takes current color (i.e., stroke color) */ } From 2a5f37f68823001fb27e26037119e5b69aa8558c Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Sun, 9 Aug 2026 18:53:00 -0300 Subject: [PATCH 2/4] Apply fix in postscriptligth.c --- src/postscriptlight.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/postscriptlight.c b/src/postscriptlight.c index bbd9417d843..9b45b63033e 100644 --- a/src/postscriptlight.c +++ b/src/postscriptlight.c @@ -5216,10 +5216,12 @@ int PSL_setcolor (struct PSL_CTRL *PSL, double rgb[], int mode) { * rgb[0] = -1: ignore. Do not change pen color. Leave untouched. * rgb[0] >= 0: rgb is the color with R G B in 0-1 range. */ + int is_font = 0; if (!rgb) return (PSL_NO_ERROR); /* NULL args to be ignored */ if (mode == PSL_IS_FONT) { /* Internally update font color but set stroke color */ PSL_rgb_copy (PSL->current.rgb[mode], rgb); mode = PSL_IS_STROKE; + is_font = 1; /* Remember this color paints text, which is filled, not stroked */ } if (PSL_eq (rgb[0], -2.0) || PSL_eq (rgb[0], -1.0)) return (PSL_NO_ERROR); /* Settings to be ignored */ if (PSL_same_rgb (rgb, PSL->current.rgb[mode])) return (PSL_NO_ERROR); /* Same color as already set */ @@ -5227,9 +5229,18 @@ int PSL_setcolor (struct PSL_CTRL *PSL, double rgb[], int mode) { /* Guard: When setting stroke or fill with transparency, preserve the other channel's transparency */ if (!PSL_eq (rgb[3], 0.0) && (mode == PSL_IS_STROKE || mode == PSL_IS_FILL)) { double transp[2], rgb_copy[4]; - /* Preserve current transparencies and update only the relevant channel */ - transp[PSL_FILL_TRANSP] = (mode == PSL_IS_FILL) ? rgb[3] : PSL->current.rgb[PSL_IS_FILL][3]; - transp[PSL_PEN_TRANSP] = (mode == PSL_IS_STROKE) ? rgb[3] : PSL->current.rgb[PSL_IS_STROKE][3]; + /* Preserve current transparencies and update only the relevant channel. + * Text glyphs are painted as filled shapes even though their color is + * tracked in the stroke slot, so font transparency must land on the + * FILL channel, not the PEN channel, or it has no visible effect. */ + if (is_font) { + transp[PSL_FILL_TRANSP] = rgb[3]; + transp[PSL_PEN_TRANSP] = PSL->current.rgb[PSL_IS_STROKE][3]; + } + else { + transp[PSL_FILL_TRANSP] = (mode == PSL_IS_FILL) ? rgb[3] : PSL->current.rgb[PSL_IS_FILL][3]; + transp[PSL_PEN_TRANSP] = (mode == PSL_IS_STROKE) ? rgb[3] : PSL->current.rgb[PSL_IS_STROKE][3]; + } /* Set transparency explicitly for both channels */ PSL_command (PSL, "%.12g %.12g /%s PSL_transp\n", 1.0 - transp[PSL_FILL_TRANSP], 1.0 - transp[PSL_PEN_TRANSP], PSL->current.transparency_mode); /* Make a copy with transparency zeroed out for psl_putcolor to avoid double-setting */ From 4d3274b44ba8278b4ac3790a5be16b3fd775b895 Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Sun, 9 Aug 2026 18:53:25 -0300 Subject: [PATCH 3/4] Undo fix in gmt_plot.c --- src/gmt_plot.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/gmt_plot.c b/src/gmt_plot.c index c9ecf6e81c6..ab920e72db6 100644 --- a/src/gmt_plot.c +++ b/src/gmt_plot.c @@ -7023,13 +7023,7 @@ unsigned int gmt_setfont (struct GMT_CTRL *GMT, struct GMT_FONT *F) { outline = 2; /* Indicates outline font is needed for filling but will not be stroked */ } else { /* Regular, solid text fill is set via stroke color */ - if (F->fill.rgb[3] > 0.0) { - /* Honor transparency embedded in the font color (e.g. red@50), which - * PSL_setcolor does not apply on its own (unlike PSL_setfill/PSL_setline). */ - PSL_command (GMT->PSL, "%.12g %.12g /%s PSL_transp\n", - 1.0 - F->fill.rgb[3], 1.0 - F->fill.rgb[3], GMT->current.setting.ps_transpmode); - } - PSL_setcolor (GMT->PSL, F->fill.rgb, PSL_IS_FONT); + PSL_setcolor (GMT->PSL, F->fill.rgb, PSL_IS_FONT); outline = 0; /* Indicates we will fill text using "show" which takes current color (i.e., stroke color) */ } return (outline); From e358aba9ac541e812c8bb8c7670e2f616b14bf7f Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Sun, 9 Aug 2026 19:22:25 -0300 Subject: [PATCH 4/4] Add tabulation --- src/gmt_plot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gmt_plot.c b/src/gmt_plot.c index ab920e72db6..3825e23ec5d 100644 --- a/src/gmt_plot.c +++ b/src/gmt_plot.c @@ -7023,7 +7023,7 @@ unsigned int gmt_setfont (struct GMT_CTRL *GMT, struct GMT_FONT *F) { outline = 2; /* Indicates outline font is needed for filling but will not be stroked */ } else { /* Regular, solid text fill is set via stroke color */ - PSL_setcolor (GMT->PSL, F->fill.rgb, PSL_IS_FONT); + PSL_setcolor (GMT->PSL, F->fill.rgb, PSL_IS_FONT); outline = 0; /* Indicates we will fill text using "show" which takes current color (i.e., stroke color) */ } return (outline);