Render All Font Awesome Characters In A Twig Template

Use the following code to render all cont awesome Unicode characters between \f000 and \ffff.

{% for i in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] %}
    {% for j in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] %}
        {% for k in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] %}
            {% set hex = 'f' ~ i ~ j ~ k %}
            <style>
              span.fontawesometest-{{ hex }}::before {
                font: normal normal normal 14px / 1 FontAwesome;
                font-family: FontAwesome;
                display: inline-block;
                text-rendering: auto;
                color: black;
                -webkit-font-smoothing: antialiased;
                margin-right: 8px;
                content: "\{{ hex }}";
              }
            </style>
            <span class="fontawesometest-{{ hex }}"> </span>
        {% endfor %}
        <br>
    {% endfor %}
    <br>
{% endfor %}

This is useful if you have a custom Font Awesome font and aren't sure what characters are available in it.

Add new comment

The content of this field is kept private and will not be shown publicly.