[boulder.pm] Font width/length for CGI scripts using CSS

Jonathan Conway rise at frii.com
Sat Dec 30 01:55:32 CST 2000

On Fri, 29 Dec 2000, Rob Nagler wrote:

> > I essentially need to be able to read in a text file...and throw the
> > text into a series of fixed sized tables. By calculating the length
> > in pixels of the text knowing the width of each charcters for a
> > particular font, I can determine when to insert carriage returns
> > or html line breaks and to carry over into the next table column.
> If you find out, let us know.  I don't believe this information is
> available.   Indeed, you have no guarantee the browser will render
> in a particular font.

If you absolutely have to do this you're not going to be able to do it in
HTML. As Rob points out there are no guarantees on the rendering end and
if you're using lynx, w3m, or the emacs w3 mode in a text term they'll
probably see only the terminal font. What you're going to have to do is
put everything in images, use Java to render the text, or produce a PDF of
the text with the proper format. The first two are awful in terms of
bandwidth and maintenance (as well as compatibility). The PDF options
isn't particularly great on either front but may be your best bet (if only
because then someone can use pdftotext or pdftohtml to extract the text).

If you can tell us why you need to do this someone may be able to come up
with a better solution for your particular problem domain.

Jonathan Conway

More information about the Boulder-pm mailing list