由于某些原因,我的jsf应用程序中没有正确解码本地存储的字体。我已经尝试了所有的东西,而且此时我很茫然。
这是css引用(位于project / resources / text中 - 与字体文件相同)
@font-face {
font-family: 'BunkenTechSansStd-Med';
src: url("#{resource['text/30B733_0_0.eot']}");
src: url("#{resource['text/30B733_0_0.woff2']}") format('woff2'),
url("#{resource['text/30B733_0_0.woff']}") format('woff'),
url("#{resource['text/30B733_0_0.ttf']}") format('truetype');
}
工作表在模板中引用为:
<h:outputStylesheet library="text" name="MyFontsWebfontsKit.css"></h:outputStylesheet>
<h:outputStylesheet library="css" name="style.css"></h:outputStylesheet>
我在chrome中收到的错误说明如下(对于所有三个文件):
"failed to decode downloaded font: http://localhost:1717/javax.faces.resource/text/30B733_0_0.woff2.jsf"
这是文件夹结构:
此外,映射如下:
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>otf</extension>
<mime-type>font/opentype</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff2</extension>
<mime-type>application/x-font-woff2</mime-type>
</mime-mapping>
最后是开发工具中的错误图片:
答案 0 :(得分:0)
JSF显然需要将文件夹导航为&#34;:&#34;而不是反斜杠。
@font-face {font-family: 'BunkenTechSansStd-Med'; src: url("#{resource['text:30B733_0_0.eot']}");
src: url("#{resource['text:30B733_0_0.woff2']}") format('woff2'),
url("#{resource['text:30B733_0_0.woff']}") format('woff'),
url("#{resource['text:30B733_0_0.ttf']}") format('truetype');}