2

I am trying to use a .ttf file downloaded from web to use 'anagram.ttf' as my font-family.

<html>
<head>
    <style>
    @font-face {font-family: 'Anagram'; src: url('anagram.ttf');}
    p{font-family:anagram;}
    </style>
</head>
<body>
    <p>This is paragraph one.</p>
    <p>This is paragraph two.</p>
</body>
</html>

But, finally my browser is showing as:

Rendered fonts: Times New Roman—22 glyphs

Also showing warning in console:

Failed to decode downloaded font: file:///C:/codebook/external%20fonts/anagram.ttf

Is my syntax wrong or any other problem?

Deadpool
  • 7,811
  • 9
  • 44
  • 88

2 Answers2

3

Please make this changes to your code so that it can understand what type of file format it is.

@font-face {
  font-family: 'Anagram';
  src: url('anagram.ttf')  format('truetype');
}
Vaibhav Mule
  • 5,016
  • 4
  • 35
  • 52
2

Do like this or there may be some error while referencing the font..

Or there may be the url issue..

@font-face {
    font-family: 'Anagram';
    src: url('anagram.ttf') format('truetype');
}

div {
    font-family: Anagram;
}
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
Amit singh
  • 2,006
  • 1
  • 13
  • 19