如何从javascript指定字体? [英] How to specify a font from javascript?

查看:122
本文介绍了如何从javascript指定字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为iPad自定义一个view-src bookmarklet。 这一个看起来相当不错。

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

但我想让它只是一点更可读:Courier(新)字体是一个有点丑的甚至(特别是?)在视网膜显示器和我喜欢DejaVu Sans Mono,摩纳哥,Lucida控制台,Bitstream Vera Sans Mono中的任何一个。

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;';

这不是骗子。

当我加载时,prettyprint可以取消我的fontFamily设置。也许我可以设置它在脚本的结尾有些...

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

推荐答案

这是因为Lucida控制台,摩纳哥在ipad上本身不可用。除非您已将它们添加为 Webfont ,否则这对IOS设备绝对没有影响。以下是ipad原生字体的列表: http://iosfonts.com/

this is because Lucida Console, dejaVu sans mono and Monaco are no avaiible natively on the ipad. Unless you have added them as Webfont, this will have absolutely no effect on a IOS device. here is a list of the ipad native fonts: http://iosfonts.com/

这篇关于如何从javascript指定字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆