Draw the outline of the text in GMT

While we choose a bright color for filling the text, a black outline is usually used to emphasize it (or it is unnoticeable). For plotting text on the canvas, we would immediately come up with pstext. But when we want to depict the outline of the text, there is no intuitive way or independent arguments for this. The -G and -W of pstext are actually for the background textbox rather than the text itself. Here, we provide two methods to achieve this: append =<pen> to the font specification in pstext or use psxy -Sl to plot the outline of the text.

Method1: Append =<pen> after pstext font specification
Actually, pstext provides a way for the outline of text, not quite intuitive though. The property of the outline can be given in -F with =<pen> (plot text first) or =~<pen> (plot outline first). The example code for the cover photo is

echo "1 0 A" |gmt pstext -R0/4/-1/1 -JX4 -F+f30,Helvetica=2,red -P -K > output.ps
echo "2 0 A" |gmt pstext -R -J -F+f30,Helvetica=~2,green -O -K>> output.ps
echo "3 0 A" |gmt pstext -R -J -F+f30,Helvetica -O >> output.ps

The black “A” at the right side (third row of the code) is for reference. If the given outline width is too large, we can find some difference. As the left “A” is set with =2,red, the red outline obviously overlaps the bottom text, which shows the text is firstly drawn then the outline. On the other hand, the central “A” is set with =~2,red, which “A” has the correct size (black filling) compare with “A” at the right side, meaning the order of plot is outline first then text.

Method 2: Use psxy
The following code shows the GMT command of the cover photo (A_A, the code of the underline is omitted for concise).

# Left blue A
echo "0 0" |gmt psxy -R-2/8/-1/1 -JX8  -Sl4+t"A"+fHelvetica -W4,black -G30/144/255 -P -K > output.ps

# Right green A
echo "6 0 A" |gmt pstext -R -J -F+f120p,Helvetica,0/128/0+jCM -O >> output.ps

In psxy, we can use -W to demonstrate attributes for the outline of the symbols and -G for the filling of symbols. Here, the argument -Sl is for plotting the text string, which enables us to focus on the color settings of the text. For a full usage of -SI in psxy, please refer to GMT documentation.