Font outline in GMT5

Added by Eric about 3 years ago

In GMT4, pstext had the option "-S<font>" that provided an outline around the text. For example, to help black text show up on a dark background, you could add "-S2p,white", which would give a nice outline that was drawn underneath the text. This option seems to have been replaced by -F+f<font>=<font>, where the font specification after the "=" gives the outline.

However, this outline now seems to be drawn after the text, which can make the text itself become very thin (or masked altogether) if the outline is wide. For example:

gmt pscoast -JM4i -R-10/10/-10/10 -Df -Sgray30 -Ggray -Na -V -K -P > test.ps
echo "0 0 hello" | gmt pstext -J -F+f12p,Helvetica-Bold,black=3p,white -R -O -V >> test.ps

Is there a way to make this outline be drawn before/underneath the text, so that the text still shows up? A workaround is to just send the text command twice, but that seems inelegant.

Eric


Replies (3)

RE: Font outline in GMT5 - Added by Remko about 3 years ago

Dear Eric,

Yes, we can confirm that we broke the compatibility with GMT4 on this one.
This is the result of a change in the PostScript code that we output in this case. The GMT5 code does not write the text twice, as GMT4 automatically did to achieve the result you were used to. Your suggestion of the workaround does exactly that.

We agree with you that the GMT5 implementation is inelegant, and should be changed. Thus, we will work on a fix that hopefully avoids having to write the text twice.

I will elevate this to a bug report, so that we can trace it.

RE: Font outline in GMT5 - Added by Remko about 3 years ago

See issue #721.

RE: Font outline in GMT5 - Added by Remko about 3 years ago

Please note that the solution to this is provided now in GMT5.2.
The use of the option -F+f<font>=~<pen> will plot the outline as in GMT4, i.e. without overplotting the text fill.

(1-3/3)