一种解决方法是只使用 ico moon 提供的 SVG 字体。这就是看起来像这样的行:
url('../fonts/icomoon.svg#icomoon') 格式('svg')
我相信画布需要 SVG 数据来呈现图标,如果您使用其他各种字体格式(eot、woff、ttf)中的一种,画布不知道如何解释 unicode 转换。
好消息是,所有与 html 画布相同的浏览器都支持 svg。
更新:为了澄清,您的字体嵌入应该在所有其他 src 行之后有 SVG 行,如下所示:
@font-face {
font-family: 'icomoon';
src:url('../fonts/icomoon.eot');
src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('../fonts/icomoon.ttf') format('truetype'),
url('../fonts/icomoon.woff') format('woff'),
url('../fonts/icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}