New modes of text rendering
|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.
#1 Updated by Michael over 2 years 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.
#4 Updated by Paul over 2 years ago
- Assignee changed from Paul to Remko
Michael, we have decided not to implement many of the more esoteric options. We have decided to keep/update 3 options:
- Filled (default, e.g. red), using way 4
- Outline font with no fill (e.g. -=green), using way 3 or 8
- Outline font with fill (e.g. red=green), using way 8
I am passing control of this issue to Remko. We will also seek to make those three mode work (and in the same way) for the quoted lines PostSCript macros.
#6 Updated by Remko over 2 years ago
I would like to avoid introducing too many options (=-, =+, =~) that would eventually result in "user error".
So I'm aiming to implement the different ways for stoke-fill, fill-stroke, stroke-clip-fill depending on whether we have filled (standard), outline, outline-filled, outline-filled-transparently. I think this can all be done through only adding "=".
If it is then practical to also support the external and internal clipping, that I'll add that as an extra bonus. Maybe that could then be done with +e as you suggested.