Feature #1213

New modes of text rendering

Added by Michael 10 days ago. Updated 3 days ago.

Status:FeedbackStart date:2018-03-09
Priority:NormalDue date:
Assignee:-% Done:


Target version:Candidate for next minor release


In PostScript, there are three operations for working with paths - fill, stroke and clip. Using the charpath command, you can get a path for an arbitrary text. The figure font.eps shows the result of applying basic operations and their combinations to text contours. Variants 2-6 can be considered basic, since the rest can be obtained by overlaying them in various combinations. GMT supports variants 1 ([size],[family],-=[width],[line]), 4 ([size],[family],[fill]), and 7 ([size],[family],[fill]=[width],[line]). Variant 8 is also supported, but not documented ([size],[family],[fill]=~[width],[line]). Clipping is not supported in any way.

Variants 7 and 8 are implemented in GMT by overlapping 1 and 4 each other in different order. This works if the colors are opaque. In the case of transparent colors, there is a difference between 1+4 and 3+4, see the figure test.pdf.

I suggest implementing clipping support by adding, for example, the =+ and =- operators. Then variant 2 can look like [size],[family],-=-[width],[line], 3 - [size],[family],-=+[width],[line], and 3+4 as [size],[family],[fill]=+[width],[line].

I also suggest adding the modifier +e[i|n] to the -F option of the text module (similar to the +e modifier for the -A option of contour module), which will implement variants 5 and 6.

font.eps - Variants of text rendering (2.47 KB) Michael, 2018-03-09 16:44

test.eps - Source file for test.pdf (1.58 KB) Michael, 2018-03-09 16:45

test.pdf - Difference between two rendering variants in case of semitransparent fill (23.7 KB) Michael, 2018-03-09 16:45

new_font_modes.patch Magnifier (4.23 KB) Michael, 2018-03-15 03:01

filled_font1.sh Magnifier (567 Bytes) Michael, 2018-03-15 03:02

filled_font1.pdf (55.1 KB) Michael, 2018-03-15 03:02


#1 Updated by Michael 5 days ago

I added the =+ and =- functionality in the attached patch. The test script and its output are also attached. In the last two lines of the test output, you can see the new bug of the GMT.

#2 Updated by Paul 3 days ago

  • Status changed from New to Feedback
  • Target version set to Candidate for next minor release

Just wanted to acknowledge the receipt of this patch. Thanks, we will consider it but it is less urgent than a few other matters.

Also available in: Atom PDF