从自定义字体获取unicode图标值 [英] Get the unicode icon value from a custom font

查看:657
本文介绍了从自定义字体获取unicode图标值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用网站

  • 在字体下(右下角选项) ,您会看到所有图标和相应代码的列表。

  • 这应该可以正常工作。






    原始答案



      @ font-face {
    font-family:icons;
    src:url(MyFont.ttf); / *替换为你的字体文件是* /
    }
    .font-icon-pencil:before {
    font-family:icons,sans-serif ;;
    content:\e038;
    }


    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?

    解决方案

    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")
    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";
    }
    

    这篇关于从自定义字体获取unicode图标值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆