Search code examples
c#htmlcssasp.netfont-face

Embedded fonts doesn't work on IE


Why my embeded fonts does not work for IE...

Here is my CSS code:

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 */
}

here is my Asp.net C# code:

<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>

here are screenshots:

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

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

EDIT: I'm dropping support for IE, cause IE does not support UTF-32 in any ways. (even my phone supports UTF-32....)


Solution

  • Here's the complete solution with the embedcode of fontsquirrel. I don't know, what your "src: local" is good for - I've never seen it before.

    @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;
    }
    

    If you don't have the complete fonts (woff etc.) you can generate them with the FontSquirrel Webfont-Generator.