Re: coordinates of words in HTML document

From: Dances With Crows (danSPANceswitTRAPhcrows_at_gmail.com)
Date: 03/30/05


Date: 30 Mar 2005 14:12:38 GMT

On 29 Mar 2005 22:19:24 -0800, Vivek staggered into the Black Sun and
said:
> I wish to find coordinates of all [the] words in [an] html document as
> they are rendered on the screen.

Why? This sounds like it'd be totally useless.

> I want the coordinates with reference to start of html document (say
> left bottom)

Most languages are read top-to-bottom, so the start of the document
would most naturally be at the top left unless you're trying to do some
sort of PostScript thing here.

> and not in reference with screen visible to user. The task at hand is
> to measure distances between words on display in HTML document.

Oh, come on! There are way too many variables for that to be useful.
The user can and will change the font, font size, and window size at any
time. HTML is *supposed* to be about separating content from
presentation anyway. Unless the HTML monkey did something like '<p
align="justify">', which shouldn't be done since justified type is
harder to read, the spaces between words will always be the same width.
The width of a word will be the sum of its character widths. You can
get those widths by finding the font used, then using XQueryFont().
(Check the man page for that function for all the details.)

> Please suggest what would be good steps for doing so.

0. Don't.
1. If you must, put some hooks into the HTML renderer of Firefox and/or
   Konqueror. Have the browser render the page and feed coordinates and
   font info for each line to a FIFO or stderr or something. Get
   coordinates of words using font metrics.

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /                Hire me! 
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume


Relevant Pages

  • Re: html fonts size
    ... and may not even display the way *you* intend due to differences ... In some environments, HTML won't display at ... realize others may prefer to view email in their own font face, size, ... plain text, which lets them view our messages the way they want. ...
    (microsoft.public.mac.office.entourage)
  • Re: No BG Color or Text Color in OE6
    ... The tab was checked in accessibility options, ... I have - COLOR AND STATIONERY AND THE FONT SIZE IS GREAT ... Preview are displayed at the bottom of the Compose Message Window. ... Her OE6 is set-up to send/receive messages in HTML mode. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: No BG Color or Text Color in OE6
    ... Go to control panel...accessibility options..display tab and make sure use high contrast is not checked. ... I have - COLOR AND STATIONERY AND THE FONT SIZE IS GREAT ... Preview are displayed at the bottom of the Compose Message Window. ... Her OE6 is set-up to send/receive messages in HTML mode. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: html fonts size
    ... should be able to impose their preferred font face, size, style on ... In some environments, HTML won't display at ... realize others may prefer to view email in their own font face, size, ... plain text, which lets them view our messages the way they want. ...
    (microsoft.public.mac.office.entourage)
  • Re: Editing software
    ... Text font is to bold for me. ... I thought the banner looked pretty cool, but then I like velvet Elvi ... I use Wordpad to hand-code my HTML and CSS. ... I don't particularly like the way Nvu formats the ...
    (comp.infosystems.www.authoring.html)