.................................
To leave Commie, hyper to
http://commie.oy.com/commie_leaving.html
.................................

> >       Personally I've worked around this by writing a
> > JavaScript that detects which browser and OS the user has 
> > and then writing a variable with the applicable font size.
> 
> Yep, that's a solution too... I've used it once, too. I wasn't too good in
> javascripting (I still am a bad coder) and the end result was... a code hell
> ;) Nobody but me could make updates to the site... ;)
> 
> Then again, if you _can_ do clean js code, this wouldn't be a problem...

        Yup, the code basically is something like this:

--nips--

if (generation4PlusBrowser) {

        font='verdana,geneva,arial,helvetica,sans-serif';

        if (Windows) {
                if (IE) {
                        smallFontSize='0.6em';
                        regularFontSize='0.7em';
                        bigFontSize='1.2em';
                }
                if (NN) {
                        ..
                }
                if (Opera) {
                        ..
                }
        }
        if (Mac) { .. }
        if (Linux) { .. }

        document.write ('<STYLE TYPE="text/css">');

        document.write ('
                .myClass { 
                        font-family: '+font+'; 
                        font-size: '+regularFontSize+';
                }
        ');

                ..

        document.write ('</STYLE>');
}

--nips--

        Though this only works if you use the same font throughout. Otherwise
you'll have to define font sizes for each font individually (e.g.
"sansSerifSmallFontSize='0.6em';"). You only need to go over the trouble
of trying out which font size is good for each browser/OS combination
once (per font), then you can use the script again..
        BTW, if you want to be really pro, you can work around for example the
fact that Netscape (Windows) doesn't have 12px Verdana (the trendiest
font on web sites right now) available as a relative font size (it is
available as an absolute size) by adding a little bit of code that
writes a hidden layer with some text in it, then measuring the height of
the layer and thus working out what font size the user has specified.
Then write the applicable absolute font size.. =) 
        (Yeah, I know that is a bit far out already..)
        
        One problem I haven't really figured out how to handle, is how to work
around the situation that the user may or may not have the font you want
to use. E.g. Verdana is available on all Windows machines but not on all
Macs - although, then many Macs still do have Verdana, so how do you
figure out that..? The font sizes are bit different on Geneva and
Verdana, and that's why I'd like to know which one the user's browser is
showing..

-- 
"Betwixt decks there can hardlie a man catch his breath by 
reason there ariseth such a funke in the night..."
                                          - W. Capps, 1623

                                    [EMAIL PROTECTED]
   legal notice: http://www.nutempo.com/message_legal.html

Reply via email to