Skip to content Skip to sidebar Skip to footer

If I Have A Generated Icon-font As Ttf, Can I Tell Which Css Content-property Belongs To Which Character?

I have a .ttf icon-font for which I have lost the guide. I am able to view the complete character set in FontBook. Is there any way to figure out which CSS content-property I can u

Solution 1:

To complete Diodeus' answer, you have to define a new font-face in your stylesheet :

@font-face {
   font-family: 'MyIconsFont';
   src: url("res/icons/MyTrueTypeFont.ttf") format("truetype");
   font-weight: normal;
   font-style: normal
}
.my-icons {
   display: inline-block;
   font-family: 'MyIconsFont';
}
.my-icons.some-symbol:before {
   content: '\0061';  // Set the proper character index here
}
.my-icons.some-other-symbol:before {
   content: '\0064';  // Set another proper character index here 
}

Then use the defined styles in a dummy <span> or <i> tag:

<p>Here is some some symbol : <spanclass="my-icons some-symbol"></span> 
and some other <iclass="my-icons some-other-symbol"></i></p>

To find out about the characters indexes, you can inspect your font in Word's Insert > Symbol > Other

Solution 2:

If you know the UTF-8 character code for the glyph in your font, you can specify it in the content: declaration in your CSS:

.example { content: "\203A" }

See also: Adding HTML entities using CSS content

Solution 3:

You can use FontForge to inspect the font and view the various notations for that glyph.

Alternatively if you convert the .ttf file to an .svg file, you can see the Unicode notations of every glyph in the file.

You can then use e.g. an entity converter to find out the ASCII representation of the Unicode notation, which you can use for the CSS content: property.

Post a Comment for "If I Have A Generated Icon-font As Ttf, Can I Tell Which Css Content-property Belongs To Which Character?"