|
From: Chris K <gnu...@li...> - 2006-04-04 18:23:53
|
Hi,
In considering whether to add enhanced text to port.trm, I have a question:
The usual enhanced_recursion calls will need feedback about the text layout size
from the terminal driver. If a terminal decided to handle the enhanced text
codes internally in the term->put_text call, without using the
enhanced_rercusion, would it still need to send any information to gnuplot about
the text size?
Also, in looking around to add enhanced text to port.trm, I was reading the
documentation in "gnuplot> help enhanced" and comparing that to the parser in
term.c and I found a contradiction.
In the help text it claims:
> (The '/' character MUST be the first character after the '{'.)
But in term.c (edited to clarity) in the enhanced_recursion routine:
> switch (*p) {
> case '{' :
> {
> while (*++p == ' '); /* Line I will call SKIPPY */
> if (overprint == 2) {
> ovp = (float)strtod(p,&p);
> if (term->flags & TERM_IS_POSTSCRIPT)
> base = ovp*f;
> else
> base += ovp*f;
> }
> --p;
> if (*++p == '/') {
Which clearly skips spaces after each opening brace. So the "MUST" in the help
and the code are in conflict. A related documentation / parser mismatch error is:
> You can change the font for one or
> both strings ('~a{.5 /*.2 o}'---an 'a' with a one-fifth-size 'o' on top---and
> the space between the number and the slash is necessary), but you can't
> change it after the beginning of the string.
Which from reading the code and performing tests is wrong -- you MUST NOT put a
space between the vertical shift and the '/'.
So it looks like the line I call SKIPPY used to be after the (overprint==2)
parsing code and has been cut and pasted to now be before the (overprint==2)
code. This causes both of the differences with the help text documentation.
There are several fixes:
*) Move SKIPPY back to below the (overprint==2) block, keep help text
*) Change the help text to reflect the new behavior
*) Put a copy of SKIPPY below the (overprint==2) block, change help text
*) Delete SKIPPY and change the help text
Also, I am amused that strtod is parsing the numbers for things like the font
size. Thus "{/=-0x.Deap1Rising}" would print "Rising" with a font size of -1.73926
This should be left undocumented. As should "/=INF" and "/=NaN".
Finally, the strtod calls all are prefixed with (float) which means it ought to
be a strtof call, so I assume this was done for portability reasons.
|