嵌入式字体不适用于IE

时间:2015-04-02 09:16:26

标签: c# html css asp.net font-face

为什么我的嵌入字体不能用于IE ...

这是我的CSS代码:

body{}
@font-face {
  font-family: 'JSeshFont';
  src: url('fonts/JSeshFont.eot'); /* IE */
  src: url('fonts/JSeshFont.eot?#iefix'); /* IE */
  src: local('JSeshFont'), url('fonts/JSeshFont.ttf') format('truetype'); /* others */
}
@font-face {
  font-family: 'JameelNooriNastaleeqKasheeda';
  src: url('fonts/JameelNooriNastaleeqKasheeda.eot'); /* IE */
  src: url('fonts/JameelNooriNastaleeqKasheeda.eot?#iefix'); /* IE */
  src: local('Jameel Noori Nastaleeq Kasheeda'), url('fonts/JameelNooriNastaleeqKasheeda.ttf') format('truetype'); /* others */
}

这是我的Asp.net C#代码:

<html>
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/demo/style.css" />
    </head>
<body>
   ...
                        <asp:Label ID="Label1" runat="server" Text="بلا بلا بلا" Font-Names="JameelNooriNastaleeqKasheeda" Font-Size="XX-Large"></asp:Label>
</asp:TableCell>
                    <asp:TableCell ID="text2" runat="server" Font-Size="Large">
                        <asp:Label ID="Label2" runat="server" Text="" Font-Names="JSeshFont" Font-Size="XX-Large"></asp:Label>
</asp:TableCell>
                </asp:TableRow>
                <asp:TableRow runat="server" Height="200">
                    <asp:TableCell runat="server">
                        <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="200" Width="300" Font-Names="JameelNooriNastaleeqKasheeda" Font-Size="XX-Large"></asp:TextBox>
</asp:TableCell>
                    <asp:TableCell runat="server">
                        <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Height="200" Width="300" Font-Names="JSeshFont" Font-Size="XX-Large"></asp:TextBox>
...
</body>
</html>

这是屏幕截图:

http://i.imgur.com/9OZ2nxD.png

http://i.imgur.com/oVgMJUs.png

编辑: 我正在放弃对IE的支持,因为IE在任何方面都不支持UTF-32。 (甚至我的手机也支持UTF-32 ......)

1 个答案:

答案 0 :(得分:0)

这是使用fontsquirrel嵌入代码的完整解决方案。我不知道你的&#34; src:local&#34;是有益的 - 我以前从未见过它。

@font-face {
font-family: 'JSeshFont';
src: url('fonts/JSeshFont.eot'); /* IE */
src: url('fonts/JSeshFont.eot?#iefix'), format('embedded-opentype'),
     url('fonts/JSeshFont.woff') format('woff'),
     url('fonts/JSeshFont.ttf') format('truetype'),
     url('fonts/JSeshFont.svg#JSeshFont') format('svg');
font-weight: normal;
font-style: normal;
}

如果您没有完整的字体(woff等),可以使用FontSquirrel Webfont-Generator生成它们。

相关问题