使用自定义字体显示条形码

时间:2014-01-16 16:22:29

标签: html5 css3 font-face true-type-fonts

我有将数字转换为条形码的字体。在我的Win 7机器上的IE 11,FF 26中没有发生这种情况。请注意,此页面是Intranet应用程序的一部分,并在Windows登录后面。

CSS:

@font-face {
    font-family: 'AdvC39b';
    src: url('fonts/ADVC39B.TTF');
    src: url('fonts/ADVC39B.TTF') format('truetype');
    /*
    font-weight: normal;
    font-style: normal;
    */
}

.displayBarCode { font-family: AdvC39b; font-size: 16px; }

Html(删除了额外内容):

<!DOCTYPE html>
<html>
<head id="Head2" runat="server">
    <title></title>
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <link href="Labels.css?v=1.0" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form2" runat="server">


                    <asp:DataGrid ID="hsGrid" runat="server" DataKeyField="HS_ID" AllowPaging="False" AutoGenerateColumns="False" Visible="False" BorderStyle="none" GridLines="none" ShowHeader="False" ShowFooter="false">
                        <ItemStyle HorizontalAlign="left"></ItemStyle>
                        <Columns>
                            <asp:TemplateColumn>
                                <ItemTemplate>
                                    <div class="printContainerDiv">

                                        <asp:Label ID="lblBarcodeEVID"  CssClass="displayBarCode" runat="server" Text='<%# "*" + DataBinder.Eval(Container.DataItem, "evid") + "*" %>'></asp:Label>&nbsp;

                                    </div>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                        </Columns>
                    </asp:DataGrid>



    </form>
</body>
</html>

附加图片.. enter image description here

1 个答案:

答案 0 :(得分:1)

您需要添加所有格式eot, ttf, woff, svg

的字体

尝试使用像icomoon这样的服务

编辑:

我使用此CSS声明自定义字体,它适用于所有浏览器

@font-face{
    font-family: "Font Name";
    src:url("fonts/font-name.eot?#iefix");
    src:url("fonts/font-name.eot?#iefix") format("eot"),
        url("fonts/font-name.woff") format("woff"),
        url("fonts/font-name.ttf") format("truetype"),
        url("fonts/font-name.svg") format("svg");
}