|
From: Harald H. <h.h...@tu...> - 2005-10-23 21:54:48
|
Ethan, I will also post this mail to the mailing list because at least parts of it can be interesting to the gnuplot community. On Sun, 23 Oct 2005, Ethan A Merritt wrote: > On Sunday 23 October 2005 01:50 pm, you wrote: > > I do not agree that (angle == 0) is sufficient. Many > > terminals switch from horizontal text to vertical text > > (angle 90) if the given angle is different from 0. If small > > rounding errors lead to vertical text instead of horizontal > > text, this is a severe bug. > > But where can these rounding errors occur? > Not internal to gnuplot, because gnuplot does not calculate > text rotation angle internally anywhere that I can think of. I don't trust C compilers that they will return exactly 0 when you set a variable to 0 in all cases. Does the ANSI C standard define that float a = 0.0; if (a == 0) ... always is true? I don't think so. May be, most architectures do so. But all? When learning programming I have always been told not to test against an exact value when using floating variables. > The only place a rotation angle gets set is in > parse_label_options(). > So it should be sufficient to check in that one place. > > --- gnuplot/src/set.c 2005-10-09 19:44:36.000000000 -0700 > +++ gnuplot-cvs/src/set.c 2005-10-23 14:27:18.995207128 -0700 > @@ -4741,7 +4788,9 @@ I find more: 3555, 4020 Sooner or later, this will also have to be added in line 3715 (by the way, funny that there still are texts not rotatable by arbitrary angles). With the approach in my patch, all newly introduced angles are covered automatically. And rounding errors of a bad C compiler implementation are eliminated. The number of calles to these functions is not too bad to slow down plots since normally, not too many texts are put into a plot (in comparison to lines, for instance). Another thing could be thought of: Terminals that can only set term horizontally or vertically should switch from horizontal to vertical text when exceeding 45 degrees, not when going from zero to one. What do you mean? But I think this could be a seperate patch after this one. And we really should find out which terminals are capable of arbitrary text angles but do not use it right now. I have found at least one of them. Best regards Harald -- Harald Harders h.h...@tu... http://www.harald-harders.de |