FontAwesome在其 CSS 文件中指定字形,如下所示:
/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure
screen readers do not read off random characters that represent icons */
.icon-glass:before { content: "\f000"; }
.icon-music:before { content: "\f001"; }
我正在尝试将此字体中的图标渲染到画布元素,但看不到如何访问这些字形。
ctx.font = "40px FontAwesome";
ctx.fillText("\f000",20,20); // no cigar
如何在 JavaScript 字符串中指定这些字形?