使用Unicode字体作为@ font-face

时间:2013-04-24 06:30:48

标签: css unicode font-face

在我的网页css文件中,我使用了" Bangla" (孟加拉国)unicode字体 - " SolaimanLipi"作为font-face; 我确定位置正确,字体名称重命名为" sol.ttf"。我将这样的字体链接起来,并在我的页面中使用了许多地方font-family:bodyf

@font-face {
    font-family:bodyf;
    src: url("../font/sol.ttf");
    format("opentype");
}

它在我的本地服务器上运行良好。但是在托管服务器托管后它无法正常工作。

我的代码有什么问题或者我错过了什么? 谢谢。

1 个答案:

答案 0 :(得分:0)

也许,在页面上使用元标记charset指定字符集可以解决问题。

所以,试着写下你的<head>标签(我认为utf-8可能适合你):

<meta charset='YOUR_SET'>

或者,如果您在html5之前的页面中,则可以使用长版本:

<meta http-equiv='Content-Type' content='text/html; charset=YOUR_SET'>

有关charset metatag here的更多信息。

另一种可能性是托管相对路径存在问题。尝试输入字体文件的绝对路径。在CSS中写下:

@font-face {
    font-family:bodyf;
    src: url("http://www.shebamcsl.com/.../font/sol.ttf") format("opentype");
}

其他可能性涉及兼容性。阅读this文章,详细了解每种浏览器的具体细节。完整@font-face的骨架如下:

@font-face {
    font-family: 'bodyf';
    src: url('../font/sol.eot');
    src: local('body f'),
         url('../font/sol.ttf') format('truetype'),
         url('../font/sol.svg#font') format('svg'); 
}