You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clipping seems not working with gmt text -G+n when text position is assigned using -F+c[justify] #8929
changed the title [-]Clipping seems not working with `gmt text -G+n` when text position is assigned using -F+c[justify] -G+n[/-][+]Clipping seems not working with `gmt text -G+n` when text position is assigned using `-F+c[justify]`[/+]on Mar 17, 2026
● Now it's clear.
Issue #8929: Root Cause
The bug is in pstext.c, in the Ctrl->F.no_input early-return branch (lines 911-986).
What happens
When using -F+cMC+t'Test text' (text and position fully specified on the command line, no input data), the code enters the no_input branch at line 911.
This branch:
1. Computes the position from +cMC (line 923)
2. Plots the text box and/or text directly (lines 955-977)
3. Returns at line 986
The problem: this branch completely ignores Ctrl->G.mode. It never collects the text into the c_x/c_y/c_txt/c_angle/c_just/c_font arrays, and never
calls PSL_plottextline() with PSL_TXT_CLIP_ON to activate the clipping path.
Why the workaround works
When coordinates are piped in (echo 0.5 0.5 | gmt text -F+jMC+t'Test text' -G+n ...), the code takes the main loop path (lines 1059-1443) instead. In
that path, when Ctrl->G.mode is set (line 1422), text info is collected into arrays, and after the loop ends, PSL_plottextline() is called at line 1495
with PSL_TXT_CLIP_ON to properly set up the clipping path.
The fix
The no_input branch (lines 911-986) needs to handle Ctrl->G.mode. Instead of directly plotting and returning, when Ctrl->G.mode is set it should:
1. Collect the text info into the clipping arrays (like lines 1422-1435 do)
2. Call PSL_plottextline() with PSL_TXT_CLIP_ON (like lines 1466-1495 do)
Or more simply, the no_input path could be refactored to feed into the same clipping logic that the main path uses.
Activity
[-]Clipping seems not working with `gmt text -G+n` when text position is assigned using -F+c[justify] -G+n[/-][+]Clipping seems not working with `gmt text -G+n` when text position is assigned using `-F+c[justify]`[/+]anbj commentedon Mar 17, 2026
(It looks like the link to 'clip -C' (https://docs.generic-mapping-tools.org/dev/text.html#g) refers to the wrong -C (text module); it's supposed to link to -C in the clip module I think.)
joa-quim commentedon Mar 20, 2026
By Claude's
pstext: fix text clipping issue 8929 (#8996)