fonteditor/template/preview-ttf.html
mkwiser 4c302114c4 add ttf2eot eot2ttf
replace ajaxBinaryFile.js to ajaxFile.js
2014-10-25 03:03:31 +08:00

53 lines
1.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<link rel="stylesheet" href="./css/preview.css">
<style>
@font-face {
font-family: '{%=fontFamily%}';
{%if(fontFormat=='eot'){%}
src: url({%=fontData%});
{%} else {%}
src: url({%=fontData%}) format('{%=fontFormat%}');
{%}%}
}
.icon {
font-family: '{%=fontFamily%}';
}
</style>
<div class="main">
<h1>fonteditor图标</h1>
<ul class="icon-list">
{%glyfList.forEach(function(glyf) {%}
<li>
<i class="icon">{%=glyf.code%}</i>
<div class="code">{%=glyf.codeName%}</div>
<div class="name">{%=glyf.name%}</div>
</li>
{%});%}
</ul>
<div class="helps">第一步使用font-face声明字体
<pre>
@font-face {
font-family: '{%=fontFamily%}';
src: url('{%=fontFamily%}.eot'); /* IE9*/
src: url('{%=fontFamily%}.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('{%=fontFamily%}.woff') format('woff'), /* chrome、firefox */
url('{%=fontFamily%}.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
url('{%=fontFamily%}.svg#ux{%=fontFamily%}') format('svg'); /* iOS 4.1- */
}
</pre>
第二步:定义使用{%=fontFamily%}的样式
<pre>
.{%=fontFamily%} {
font-family:"{%=fontFamily%}" !important;
font-size:16px;font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
</pre>
第三步:挑选相应图标并获取字体编码,应用于页面
<pre>
&lt;i class="{%=fontFamily%}"&gt;&amp;#x33&lt;/i&gt;
</pre>
</div>
</div>