>Julian Arnold (jools@arnod.demon.co.uk) wrote:
>[snip]
>: If you get the same result I did you will see that the first line of text is
>: proportional but shouldn't be, while the second line isn't and shouldn't be
>: either. It seems that the inclusion of the '^' escape character actually
>: triggers the font command -- otherwise it doesn't do anything noticeable.
>
>Font on and font off seem to just alter the "use non-proportional font" bit in
>the header, so whether or not the Inform code works as expected will depend on
>how often the interpreter looks at this bit. Most interpreters seem to cache
>lines and only print when they reach a carriage return, etc. If they only check
>the bit at this point, then the result will be as you describe above (something
>similar seems to happen in the IF competition entry "MST3000").
>
A better solution, as has now been implemented in Zip 2000 (which Jools is
using) is to trap writes to the fixed-space bit in the STOREW and STOREB
routines. These can then be embedded as control codes in the line buffer
so they occur at the appropriate point (in the same way the SET_TEXT_STYLE
changes are already done). Colours can be done in the same way, although
that would have to be a 3-byte control sequence. Simply flushing the line
buffer doesn't quite work properly with Zip's original fit_line function.
For example if you flush the buffer at font changes, in Beyond Zork you
see
+--------------------Screen Width---------------------------------+
The meaning of the rumpled scroll is obscure. It has the runes $&
$&* inscribed across the top.
with the word in runes not being word-wrapped. This is because it won't
wrap the first word after a buffer flush (because there's no previous
space in the line buffer to chop the buffer at).
Anyone using a ZIP core out there should follow Stefan's advice in
his list of ZIP bugs, and totally overhaul the write_char routine to
use a more sensible fit_word function, called on every space, rather
than calling fit_line on every character. This has speeded up my
interpreter quite a lot, and helps prevent problems like these.
[Anyone using unregistered Zip 2000 - all these changes have been made
in version 1.06, so you'll have to wait a bit. Version 1.05 added support
for V6 (text only, at the moment).]
Kevin
=====