Skip to content

Fix font color transparency (red@50 in -F+f) being silently ignored - #9126

Merged
remkos merged 4 commits into
masterfrom
fix_9125
Aug 10, 2026
Merged

Fix font color transparency (red@50 in -F+f) being silently ignored#9126
remkos merged 4 commits into
masterfrom
fix_9125

Conversation

@Esteban82

Copy link
Copy Markdown
Member

Done with Claude Sonnet 5
Cause: in PSL_setcolor(), font colors are internally treated as PSL_IS_STROKE, so embedded @<transparency> was applied to PEN_TRANSP instead of FILL_TRANSP — but text is painted as a filled shape, so it had no visible effect.
Fix: track that the color came from PSL_IS_FONT and route its transparency to FILL_TRANSP.

map

Without this fix, the "GMT" in the center has no transparency.

Full script:

gmt begin map png
    gmt coast -Rg -JH10c -Baf -Glightgreen -Slightblue
    echo GMT | gmt text -F+cMC+f40p,red@50      # Now works
    echo GMT | gmt text -F+cML+f40p,red -t50    # Works
    echo 180 40 | gmt plot -Sc1c -Gblack@50     # Works
gmt end

Fixes #9125

@Esteban82
Esteban82 requested review from joa-quim and seisman August 9, 2026 22:28
@Esteban82 Esteban82 added add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence. labels Aug 9, 2026
@seisman

seisman commented Aug 10, 2026

Copy link
Copy Markdown
Member

I guess the bug was introduced in #9046 or #8882.

@remkos
remkos self-requested a review August 10, 2026 11:23

@remkos remkos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested out the patch on a similar script for myself.
It works. Thanks!

@remkos
remkos merged commit 101e41f into master Aug 10, 2026
10 of 14 checks passed
@remkos
remkos deleted the fix_9125 branch August 10, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug with gmt text -F and transparency with @ (red@50)

3 participants