How to specify a font from javascript?

Posted by Steven Lu on Stack Overflow See other posts from Stack Overflow or by Steven Lu
Published on 2012-04-01T17:09:39Z Indexed on 2012/04/01 17:30 UTC
Read the original article Hit count: 332

Filed under:
|
|
|
|

I am trying to customize a view-src bookmarklet for iPad. This one is looking pretty good so far.

But I want to make it just a little more readable: The Courier (New) font is a bit ugly even (especially?) on the retina display and I'd prefer any one of DejaVu Sans Mono, Monaco, Lucida Console, Bitstream Vera Sans Mono.

I tried to modify the bookmarklet script by adding:

pre.style.fontFamily = '"DejaVu Sans Mono", "Lucida Console", Monaco;';

It's not doing the trick.

Perhaps prettyprint cancels out my fontFamily setting when it loads. Maybe I can set it at the end of the script somehow...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about css