dotted hfill (was: [cl-typesetting-devel] HTML rendering)

Klaus Weidner kw at w-m-p.com
Wed Apr 21 20:50:57 UTC 2004


On Wed, Apr 21, 2004 at 10:27:45PM +0200, Marc Battyani wrote:
> "Klaus Weidner" <kw at w-m-p.com> wrote:
> > The only tool I know that does a good job is html2ps, but unfortunately
> > that's an unholy combination of obfuscated Perl with obfuscated
> > PostScript.  I'll try to figure out how its table model works (the layout
> > calculations are done in PostScript), maybe that will provide some
> > pointers.
> >
> > Or is anyone willing to concede defeat and admit that PostScript can do
> > something Lisp can't? ;-)
> 
> Heh! Are you really sure it works well ? There are several papers on tables
> layout but none has a magic recipe...

I'm not saying that html2ps works perfectly, but it *is* far better than
any other tools I tried, including all popular web browsers. At least
from the point of view of people who want to actually have the content of
the table be on the page when printed, rather than arbitrarily truncated
somewhere.

One trick it does is to shrink the font size if there's no other way to
fit the table on the page. But that's only a last resort, the default
layout algorithm is good enough that this is only needed in extreme
cases.

Let me know if you're interested in examples, and I'll make some.

> > What I personally need most urgently is change marking including change
> > bars, and I already have a plan for that - just insert (changebar-start)
> > and (changebar-end) special boxes, and add a special-fn to the output
> > routine to draw lines in the margin at the corresponding y coordinates.
> 
> Yes, this one is easy. Just do it after the layout pass. You can look at the
> example where I draw circles (and join them) under each #\a and #\Space of
> the text.

That's where I got the idea ;-)  It's great that this is so easy,
compared to how the pain involved in altering the LaTeX output routines
even slightly. 

> Strikethrough and underline? Well this should be added to text-style.
> Drawing them is probably not difficult I will add this to my "to do soon"
> list ;-)
> 
> I have variables and styles for background color but it's not used yet. If I
> find the time to do the underline stuff I will do that as well as it's
> probably almost the same code.

A text style makes the most sense. The obvious implementation would do
this character by character - an optimization might be to use longer
lines (or boxes for the background) for multiple characters, but I'm not
sure if that would be worth the effort.

Hmmm, one approach would be to support a function-valued style parameter,
which is called when the character is stroked and can add whatever
decoration it wants, based on the box geometry. Ideally this would be
stackable, so that for example colored backgrounds don't get turned off
when an underline is added in a subsidiary span.

If I have some spare time I may look at it myself, but no promises...

-Klaus




More information about the cl-typesetting-devel mailing list