[英]Font-face as base64 with fallbacks
Following this threat I´d like to include a fontface as follows:在这个威胁之后,我想包括一个字体如下:
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot');
src: url('webfont.eot?#iefix') format('embedded-opentype'),
url('webfont.woff2') format('woff2'),
url('webfont.woff') format('woff'),
url('webfont.ttf') format('truetype'),
url('webfont.svg#svgFontName') format('svg');
}
But instead of loading files from the filesystem the filecontent is coming from a database as base64 string.但不是从文件系统加载文件,而是文件内容来自数据库作为 base64 字符串。 My Question is do I have to add the base64 string for each format (woff,woff2,svg,eot,ttf)?
我的问题是我是否必须为每种格式添加 base64 字符串(woff、woff2、svg、eot、ttf)? like:
喜欢:
url(data:application/font-woff;charset=utf-8;base64,d09GMgABA…
url(data:application/font-woff2;charset=utf-8;base64,d09GMgABA…
url(data:application/x-font-truetype;charset=utf-8;base64,,d09GMgABA…
url(data:image/svg+xml;charset=utf-8;base648;base64,,d09GMgABA…
url(data:application/vnd.ms-fontobject;charset=utf-8;base64,d09GMgABA…
I´m asking because when looking at fontsquirrels generated base64 generated stylesheets they only provide one as base64 others as local files.我在问,因为在查看 fontsquirrels 生成的 base64 生成的样式表时,它们只提供一个作为 base64 其他作为本地文件的样式表。
Base64 works with ttf-format. Base64 适用于 ttf 格式。
Example:例子:
@font-face {
font-family: "CustomFont";
src: url(data:font/truetype;charset=utf8;base64,AAEAAAAQAQAABAAAT...) format("truetype");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.