实现方案
- 使用宋体字体
优势:1.字母符号等宽; 2.汉子宽度为其他一个字符的两倍符合我们的要求;3.字体宽度正好为font-size的一半
- 百度下载宋体ttc格式;
- www.fontke.com/tool/fontfa…
- 转换其他格式
- 为什么font-face要同时设置ttf eof woff woff2 svg这么多格式;
IE浏览器:EOT Mozilla浏览器:OTF,TTF Safari浏览器:OTF,TTF,SVG 歌剧:OTF,TTF,SVG Chrome浏览器:TTF,SVG
<!--设置字体-->
@font-face {
font-family: 'simsun';
src:
url('./font/simsun.woff2') format('woff2'),
url('./font/simsun.woff') format('woff'),
url('./font/simsun.ttf') format('truetype'),
url('./font/simsun.eot') format('embedded-opentype'),
url('./font/simsun.svg') format('svg');
font-weight: normal;
font-style: normal;
}
.wrap {
font-family: simsun;
width: (字符个数/2) em;
}
复制代码