在primefaces火花布局中升级字体真棒

时间:2017-02-01 23:47:04

标签: primefaces font-awesome

我正在使用primefaces spark-layout-2.1.2,我需要升级字体真棒才能使用新图标。 我改变了这个标题但还没有工作:

@font-face {
font-family: 'FontAwesome';
src: url("#{resource['spark-layout:fonts/fontawesome-webfont.eot']}&v=4.3.0");
src: url("#{resource['spark-layout:fonts/fontawesome-webfont.eot']}&v=4.3.0#iefix")
    format('embedded-opentype'),   url("#{resource['spark-layout:fonts/fontawesome-webfont.woff2']}&v=4.3.0")
    format('woff2'),   url("#{resource['spark-layout:fonts/fontawesome-webfont.woff']}&v=4.3.0")
    format('woff'),   url("#{resource['spark-layout:fonts/fontawesome-webfont.ttf']}&v=4.3.0")
    format('truetype'),   url("#{resource['spark-layout:fonts/fontawesome-webfont.svg']}&v=4.3.0#fontawesomeregular")
    format('svg');
font-weight: normal;
font-style: normal;

}

1 个答案:

答案 0 :(得分:0)

1)您需要更新primefaces包路径中的文件:

  

的src /主/资源/ META-INF /资源/ primefaces / FA / FontAwesome.otf   的src /主/资源/ META-INF /资源/ primefaces / FA / fontawesome-webfont.eot   的src /主/资源/ META-INF /资源/ primefaces / FA / fontawesome-webfont.svg   的src /主/资源/ META-INF /资源/ primefaces / FA / fontawesome-webfont.ttf   的src /主/资源/ META-INF /资源/ primefaces / FA / fontawesome-webfont.woff   的src /主/资源/ META-INF /资源/ primefaces / FA / fontawesome-webfont.woff2

2)编辑文件src / main / resources / META-INF / resources / primefaces / fa / font-awesome.css并改为:

src: url("#{resource['primefaces:fa/fontawesome-webfont.eot']}?v=4.7.0");
src: url("#{resource['primefaces:fa/fontawesome-webfont.eot']}&#iefix&v=4.7.0") format('embedded-opentype'), 
       url("#{resource['primefaces:fa/fontawesome-webfont.woff2']}?v=4.7.0") format('woff2'), 
       url("#{resource['primefaces:fa/fontawesome-webfont.woff']}?v=4.7.0") format('woff'), 
       url("#{resource['primefaces:fa/fontawesome-webfont.ttf']}?v=4.7.0") format('truetype'), 
       url("#{resource['primefaces:fa/fontawesome-webfont.svg']}?v=4.7.0#fontawesomeregular") format('svg');

3)不幸的是,您需要在src / main / resources / META-INF / resources / primefaces / fa / font-awesome.css中手动添加所有新图标,因为这两个示例如下:

.fa-handshake-o:before {
    content: "\f2b5";
}
.fa-envelope-open:before {
   content: "\f2b6";
}

有关4.7.0版本中添加的图标的完整列表,请查看此提交https://github.com/primefaces/primefaces/commit/b40b2fd5a27956d49d247b24c8aac60a8a3301eb

有一些问题,为什么这么难以更新,也许将来会变得更加简单https://github.com/primefaces/primefaces/issues/1956