On Sun, May 05, 2002, Bill Janssen wrote:

> Each paragraph starts with a fresh graphics context, as I
> understand it.  That is:
> 
>   - background color is white, foreground color is black

As far as I can tell the colors are only restored once -- after the
record has been rendered, i.e. it will not be restored for each
paragraph. It would probably make sense to also restore the color
for each paragraph, though (to make it consistent with the other
paragraph "states").

>   - margins are 0 pixels left, 0 pixels right
>   - the "regular" font is used (instead of bold, or <h1>, say)
>   - the alignment is left-justified

InitializeParagraphContext in paragraph.c

>   - underlining, italic, and strikethrough are off

Beginning of DrawParagraph in paragraph.c

> Is this right?

Yep (except for the colors), but don't forget that this is the way
*I* interpret the data and doesn't really have much to do with the
document format (unless you add these requirements to the format:)

In a lot of instances (regardless of whether that is a good idea or
not) the viewer has "dictated" how the parser would create its data,
or as David put it once, "the tail is wagging the dog" ;-) 

> But there seems to be some confusion here.  For instance, if you look
> at a dump of the function codes in a text record,

You can actually run plucker-decode? ;-) All I get is the first
paragraph and then it crash,

Traceback (most recent call last):
  File "/home/micke/.bin/plucker-decode", line 1951, in ?
    verbose=option['d'])
  File "/home/micke/.bin/plucker-decode", line 1860, in Undump_PluckerDocument
    pluckerdoc.undump_record (data, verbose)
  File "/home/micke/.bin/plucker-decode", line 1306, in undump_record
    self._documents[0].append (paragraph)
AttributeError: PluckerTextDocument instance has no attribute 'append'

> every paragraph starts off with a 5-byte header that sets the
> foreground color to black.  That seems to be nuts (aside from
> wasting space).  I'm going to take it out of the parser.

Well, I wouldn't go as far as saying it is nuts. Nothing in the
document format says that a Plucker conformant viewer should
initialize the paragraph context for each paragraph, so the parser
could interpret that as a requirement for it to initialize the
context...

That is, if you choose to remove this from the parser I'd guess 
you should also remember to add this new requirement to the document
format.

> There's also code in the parser that seems to imply that a function
> code of SET_STYLE (which should really be called SET_FONT)

It sets a *style* (e.g. header, fixed-width, regular text) and then
the viewer is free to select the appropriate *font* for this style.

> also resets the whole graphics state in some way.  Is that correct?

No idea. Maybe you could point out what part of the parser we are
talking about? Still, I'd guess only Holger would know the answer,
if he still remembers (after all, this was written in 1999) ;-)

/Mike

Reply via email to