display uninstalled font on a webpage [duplicate]

妖精的绣舞 提交于 2019-12-12 08:55:40

问题


Possible Duplicate:
Non-Standard fonts in web?

I have created a Unicode font and I would like to use it on my webpage. I want people to see and read the font. Can they do it without installing the font? Something like run the font from server?

If I remember correctly, I have seen this long time back.


回答1:


You may do this using CSS3's @font-face feature. But you have to provide the necessary font formats.

FontSquirrel's @font-face Generator is a nice web tool that does all the dirty work for you. It is very easy to use and creates all the necessary files, including CSS stylesheets and a HTML example file.

What's really valuable is that it includes all formats and hacks needed to display the font in all major browsers, something which is not so easy to get right.




回答2:


You can use @font-face

In your css you the font would be declared using the @font-face rule.You can specify the font family, specify the links to the fonts in the different formats.

@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), 
     url('webfont.woff') format('woff'), 
     url('webfont.ttf')  format('truetype'),
     url('webfont.svg#svgFontName') format('svg'); 
}

In your html you then call it using font-family

body 
{
   font-family: 'MyWebFont', Fallback, sans-serif;
}


来源:https://stackoverflow.com/questions/12963142/display-uninstalled-font-on-a-webpage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!