开发者

How to generate webfont dynamically from webfont service?

开发者 https://www.devze.com 2023-01-06 17:51 出处:网络
Is there a way to style text font dynamically base on selected font in a list? For example, we can see this in Microsoft Word, where you can highlight some text and then change the font style by selec

Is there a way to style text font dynamically base on selected font in a list? For example, we can see this in Microsoft Word, where you can highlight some text and then change the font style by selecting a font style from the font dropdown box. I am trying to create a component similar to this in the browser. Current I am using the webfont services provides by fonts.com, however, it looks like the font rendering only happen at page load ti开发者_JAVA技巧me, and not able to do it dynamically. Anyone has anyway way to tackle this problem? Many thanks.


You ought to be able to do something with Google/Typekit's WebFont Loader library. Create an array of WebFontConfig objects against your drop down box then pass the relevant object into WebFont.load in the onchange event.

0

精彩评论

暂无评论...
验证码 换一张
取 消