Thom Brown wrote:
> On 11 September 2010 14:41, Bruce Momjian <bruce@momjian.us> wrote:
> > Thom Brown wrote:
> >> I came up with something very similar last night but I hadn't finished
> >> playing with it:
> >> http://pgweb.darkixion.com:8081/media/js/monospacefix.js
> >>
> >> But yes, I really didn't like the idea of having individual CSS files
> >> for varying differences of font type when it could just be calculated.
> >> ?I'll try to get time to test it properly this weekend.
> >
> > Nice. ?Do you need those paragraphs with "x"?
>
> I could probably get away with non-breaking spaces, but the purpose is
> to prevent some browsers from throwing the element away as an empty
> one, thereby preventing us having a sample to test against. IE tends
> to do this in some scenarios.
OK, I never tested if this would work (no text):
document.write('<pre id="monotest" style="display: none;"></pre>');document.write('<p id="paratest" style="display:
none;"></p>');
Ah, I see your 'display: none' now that prevents it from appearing ---
good idea.
> > Do they show up in the document?
>
> The x's would if the user had javascript enabled and CSS disabled.
Seems they would have even worse problem than a few X's if they turned
off CSS, so it seems fine.
> > Does it work if they have no text node?
>
> Hmm... I don't know what this means. Could you explain?
See above, and you already thought of that.
> > If fixed with is larger then proportional, we leave it alone?
>
> Yes, this needs to be worked on too which is why I hadn't finished
> with it. The script doesn't yield text sizes in Opera, so the
> calculation won't fall into the "if" statement anyway, but yes, in
> theory someone might actually have their monospace default set higher
> than proportional... although that would be weird.
Yep, odd, but seems worth fixing if it is just a simple != change.
-- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB
http://enterprisedb.com
+ It's impossible for everything to be true. +