Goals are to fix/enhance three aspects of rendering sloped vectors:
1. draw near-horizontal slopes more smoothly, by alternating dashes and underscores -- sub-"pixel" rendering, in a sense
2. draw near-diagonal slopes more smoothly, by alternating (back)slashes and underscores
3. draw exact diagonals with (back)slashes, rather than pluses
All three goals are only meant to affect vectors drawn with dumb_pen=DUMB_BORDER_CONST, as despite the name this applies to ordinary plotted lines when using the ansi/ansi256/ansirgb options.
'1_bresenham.patch' is the same patch I submitted in [bugs:#2401] using Bresenham's line algorithm; this particular fix is not essential, but the all-integer representation makes these features, especially goal 2, significantly easier and clearer to implement.
'2_underscore.patch' and '3_slash.patch' implement goal 1 and 2 respectively. The math in patch 3, in particular, is just a little voodoo; I know it's right, but I have a hard time articulating an explanation.
'4_diagonals.patch' gets at goal 3 by refactoring the else clause, which is a little confusing to me. The code clearly handles both perfect diagonal vectors and zero-length vectors, yet the comments suggest that the clause is intended only to handle zero-length vectors -- or perhaps, to handle both zero-length vectors plotted with DUMB_*_CONST , and diagonal vectors plotted with a "normal" linetype character? But since ansi* does use DUMB_BORDER_CONST for plotting lines of any slope, including diagonals.... yeah, I'm definitely confused, but hey if there's code I don't fully understand, clearly the thing to do is recklessly change it.
So I've rolled the diagonal cases into the |dx|>|dy| code, which is perfectly capable of handling them already. and that leaves only zero-length vectors for the else clause to handle.
Let me know if diagonals were handed separately for a reason; I can certainly do that differently.
I've attached 'slopetest.gnuplot' (input), 'slopetest.out' (output from unpatched gnuplot), and 'slopetest.enhanced' (output with all patches applied); the first two are of course exactly the same as in [bugs:#2401]. This test demonstrates all three enhancements: goal 1 down the left side, goal 2 across the bottom and up the right, goal 3 on the diagonal from 112,13 to 102,23.
The near-vertical slopes (those rendered with '|') are unchanged, other than fixing [bugs:#2401].