14

I need to write a CSS for an icon font build using the site flaticon. I develop using a MAC with 10.10 and can't find any way to retrieve a single character Unicode value that I need to insert inside my CSS

.font-icon-pencil:before {
    content: "\e038";
}

How can I read the contents of a font file, to get the icon codes within that custom-made font?

Omar
  • 11,783
  • 21
  • 84
  • 114
al404IT
  • 1,380
  • 3
  • 21
  • 54
  • `font-family: font-awesome;` ? – Benjamin Dec 02 '14 at 10:33
  • font family is "MyFont" but it doesn't really metter, in CSS for each icon i need to make a specific class with specific character unicode value, i guess the start from 001,002, etc – al404IT Dec 02 '14 at 10:39

3 Answers3

23

On MacOS Sierra I'm able to get a unicode value of icon in Font Book (default app).

  1. Install the font.
  2. Open the user installed font in Font Book.
  3. Move the mouse on the desired icon. You should get a title saying unicode value on hover.

Font Book

Micer
  • 8,731
  • 3
  • 79
  • 73
  • 10
    Make sure you click on the grid icon in the toolbar as I found the hover didn't work initially because the first icon is selected by default. – timiscoding Jun 26 '17 at 05:31
  • what about for windows? – Jono Jun 08 '20 at 10:39
  • @Jonathan I have no idea sorry, the question was about MacOS. – Micer Jun 08 '20 at 12:36
  • For Windows you can use the system program 'Character Map' @Jonathan. As I recall you need to turn on a menu option in the program to see the unicode value. – Matty J Oct 07 '21 at 07:15
12

https://fontdrop.info : Very useful website where you can see all the unicode codes at once

enter image description here

warfish
  • 613
  • 5
  • 20
9

Edited answer (April 29th, 2015)

@al404it commented: "I know how to write the CSS part. I don't know how to get, from a customized font, the corresponding code to use in content: "xxxxx";"


Answer

Option 1)
Font Viewer, OR similar font viewer software
This is the easiest option.

  1. Install the FontViewer software
  2. Get the font's icon codes from the character map
  3. Use any online code converter, like Rishida Unicode Code Converter, to get the escaped CSS code

If this doesn't work for you...

Option 2)
Use the icomoon app

  1. Sign up AND create a new project
  2. In that project, import your font files (Top left button called "+ Import Icons")enter image description here
  3. Under Fonts (Bottom right option), you'll see the list of all your icons and respective codes.

This should work for sure.


Original answer

@font-face {
    font-family: icons;
    src: url(MyFont.ttf); /* Replace with thatever your font file is */
}
.font-icon-pencil:before {
    font-family: icons, sans-serif;;
    content: "\e038";
}
Omar
  • 11,783
  • 21
  • 84
  • 114
  • i know hot to write the CSS part i don't know how to get, from a customized font, the corresponding code to use in content: "xxxxx"; – al404IT Apr 24 '15 at 07:59
  • @al404IT While I look for an answer to your question, I would suggest to edit your question and start a bounty. This is due to your question not being clear as to what you really want (to get the "CSS content" codes from the font files) – Omar Apr 29 '15 at 21:25
  • 4
    with font viewer i can't see any info about character under character map, with second method i can import my font that is a .ttf file it says "Please choose SVG images, SVG fonts or JSONs exported by IcoMoon." – al404IT May 05 '15 at 07:22