|
From: Daniel J S. <dan...@ie...> - 2004-10-26 19:02:23
|
Daniel J Sebald wrote:
>> Another possible ingredient to this is the infamous signed vs. unsigned
>> confusion that infests practically all of gnuplot.
>
>
> makes me wonder now. They wouldn't say "too large" if in fact they
> meant "negative" as the source of the problem. So I think you are right.
I suspect that may be it. The PDF library seems to be robust on the
placement of text partially off the top of the canvas. Also, the
placement of tics far off the top:
set xtics offset 0,graph 10
causes no problems for PDFlib.
I think I see the issue now... what you all were probably talking about
but I paid no attention. In the terminal directory, the .trm files all
have "unsigned" for coordinates, e.g.,
TERM_PUBLIC void
PDF_put_text (unsigned int x, unsigned int y, const char *str)
So, the question is, how is it that the PostScript terminal *works
properly*? Because it shouldn't. It works because it is printing the
unsigned numbers as signed:
sprintf(abso, "%d %d M\n", x, y);
sprintf(rel, "%d %d R\n", dx, dy);
So, the importance of the signed/unsigned issue isn't until its use.
(Conversion from signed int to unsigned int or vice versa doesn't do
anything. Only when it is interpretted is it important.) The
PDF_put_text fails because it has to do the conversion:
double h = x, v = y;
near the top.
OK. I'm getting the feeling this is case of someone having to go
through the pain of changing all those "unsigned" coordinate values
inside the terminal drivers to "signed". At least I don't think it
should wreck any working behavior. It can only make bad behavior better.
If that's the case. I'd suggest someone announce "I'm going to do this
huge patch today, so nobody change anything in CVS for the day". Then
after that, we'll all shake the bugs out of the thing.
...
And I just tried a fix that sort of confirms the problem. Inside the
PDF terminal driver, I made the following change to the first few lines
and the PDFlib abort goes away:
TERM_PUBLIC void
PDF_put_text (unsigned int ux, unsigned int uy, const char *str)
{
char *alignment = NULL;
int x = ux, y = uy;
double h = x, v = y;
If people are happy with that as a fix, I'm fine with it too. [Or it
could be just
double h = (signed) x, v = (signed) y;
if x and y are used no further down the road.] Whether it says "signed"
or "unsigned" in the function, no big deal to me. However, who knows if
all compilers behave the same regarding the signed/unsigned conversion.
Dan
|