-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 04 June 2003 06:46, Martin Moss wrote: > Hi All, > > I'm sure this can't be an issue that hasn't been tackled, but I couldn't > find anything in the archives so:- > > I'm trying to find a way in which I can calculate the pixel width of a > string in a given font. > I'm doing this to feed a javascript file, so I am also looking at doing > this in javascript also. >
I would go back and re-read the specifications for HTML and CSS, and think about the design philosophy one more time. Do you really want to control the user's experience to that degree? What happens when they want to make the fonts bigger or smaller? What if they assign a stylesheet that puts all fonts in an unexpected font face, where the measurements just don't mean the same thing? What if they are viewing a translated page via babelfish? What if they are blind and are hearing an aural rendering of your page, or feeling a braille printed version? How will your page appear to Googlebot and other bots? In short, you have little to no control over what *exactly* the user sees, and this is for a good reason. You create content, and perhaps suggest a way it should be rendered via CSS. They decide how it should actually appear, and they may or may not honor your idea of what it should look like. Trying to violate this will only lead to difficulty. - -- Jonathan Gardner <[EMAIL PROTECTED]> (was [EMAIL PROTECTED]) Live Free, Use Linux! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+5eTXWgwF3QvpWNwRAqpnAKDl0dV4Xozh2UaXBYZNcy3vS8l9IQCg3LbV bVhvH3QxFVNil/vnuo7sNo8= =OPFi -----END PGP SIGNATURE-----