Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : Span tags in LRS and LRF files -- do I understand them?


Falstaff
01-30-2007, 11:43 PM
From looking at lrf dumps and lrs2lrf, here are some conclusions about the Span tag, which is used to embed text style changes in the text of an LRF file. Please agree or disagree if you know about this stuff.

The example:
<Span fontsize="60">hi</Span> there

When compiled by lrs2lrf, this adds the fontsize attribute to the text stream, but also adds the "undo" of the attribute automatically. So "hi" would be followed by a fontsize=100, assuming that was the old value. lrf2lrs reveals this extra attribute, by decompiling the above to:

<Span fontsize="60">hi</Span><Span fontsize="100">there</Span>

I am assuming that the old value comes from the settings in the textstyle (or book style, I guess.)

It looks like lrf2lrs has some code to try to not print the undo attributes, but the section is commented out.

Does this description seem correct?

igorsk
01-31-2007, 04:55 AM
Yes, lrf2lrs outputs the "real" content of the text stream. I added some code to group the attribute changes together, but it doesn't work very well in some cases. Also, in LRS you can change attributes from within the <P> tag: <P fontsize="60">text</P>, however, this is still translated into the same sequence of tags, and lrf2lrs is not very sofisticated to figure it out.

Falstaff
01-31-2007, 09:34 AM
Thank you for the reply, and also for the lrf2lrs program itself. I can see that trying to decide if an attribute is an "undo" or a new setting could be a difficult problem. I'm glad you put out the real stream, otherwise I would not have known those extra attributes were required.