开发者

Install .ttf file in client

I have a question about TrueType Fonts and their installation in the client side. I know they can be installed in the operating system manually. But I have another question.

For my Java web application, it has been designed a new font, formatted in its .ttf file. I'd like to config the font in my application (.war file), so the client side (any computer with a web navigator like IE, Firefox, etc.) goes to the server, that generates the page (from .jsp files) and the client views it with the font.

I know my question is very abstract. Must the font file be distributed to all the clients? Or is there any other solution which does not involve the final user, by doing something in the server?

Any suggestion is very appreciated. 开发者_开发百科Thanks in advance.


You can't install the font to the client, but modern browsers can load them as needed. Google provides a number of fonts via their Webfonts API. If you want to use custom fonts I'd suggest to look at how they do it.

Basically in HTML you load a CSS like

@font-face {
  font-family: 'Tangerine';
  font-style: normal;
  font-weight: normal;
  src: local('Tangerine'), url('http://themes.googleusercontent.com/font?kit=HGfsyCL5WASpHOFnouG-RKCWcynf_cDxXwCLxiixG1c') format('truetype');
}

The URL points to the TTF file. This makes the font "Tangerine" available in your site. For the full example look at their Getting Started document.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜