简体   繁体   中英

CSS Custom Font Not working

I have installed new font in windows and now i want to use that font in my web as a custom font. In image below it will describe all of my problem http://i.imgur.com/hkbfA6O.png

在此处输入图片说明

Here is my Code

<html>
    <head>
        <meta charset='uft-8' />
        <style type="text/css">
            @font-face {
                font-family: urdu;
                src: url(font/urdu/NOORIN01.TTF);
            }
            @font-face {
                font-family: eng;
                src: url(font/sansation_light.woff);
            }

            body{
                font-size:30px;
            }
            .urdu{font-family:'urdu';}
            .eng{font-family:'eng';}
        </style>
    </head>
    <body>
        <div class='urdu'>میں نے آپ کے مسئلے کو قتل کرنے جا رہا ہوں</div>
        <div>میں نے آپ کے مسئلے کو قتل کرنے جا رہا ہوں</div>
        <div class="eng">The quick and brown fox jump over the lazy dog.</div>
    </body>
</html>

here are font files
http://speedy.sh/WdxpP/sansation-light.woff
http://speedy.sh/wEzZ6/NOORIN01.TTF

The font is broken. I tested with the NOORIN01.TTF font available from the address specified and tested with the code in the question. This is what I see in Firefox console (on Win 7):

downloadable font: hdmx: Table discarded (font-family: "urdu" style:normal weight:normal stretch:normal src index:0)
source: [...]
downloadable font: not usable by platform (font-family: "urdu" style:normal weight:normal stretch:normal src index:0)
source: file:///C:/Users/Jukka/Documents/Fonts/NOORIN01.TTF

Looking at the font in a font inspector, I notice that the characters are assigned to Private Use codepoints. This could “work” as such, but then the HTML content needs to contain those code points. And it apparently fails to work since some table in the font is broken.

The conclusion is: find another font.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM