无法将base64编码的EOT字体包含在内联CSS中

时间:2019-01-10 12:10:50

标签: html css base64 font-face eot

在通过base64对字体进行编码之后,我需要在一个HTML文件中将IE 7的.EOT格式的Roboto Condenseded字体包含在IE 7的嵌入式CSS中。

所以首先我已经用PHP代码对字体进行了编码

<?php
$base64 = base64_encode(file_get_contents('roboto-condensed.eot'));
file_put_contents('base64_version.txt', $base64);
?>

我知道了

DGMAA...........mAskA

然后我尝试包括以下字体:

<style>
@font-face{
font-family:'Roboto Condensed';
src:url('data:application/x-font-eot;base64,DGMAA...........mAskA') format('embedded-opentype');
}
body{
font-family:'Roboto Condensed';
}
</style>

Some text

但是没有加载字体。但是,如果我将其包含在

src:url('roboto-condensed.eot');

已成功加载

我也尝试过

src:url('data:application/vnd.ms-fontobject;charset=utf-8;base64,DGMAA...........mAskA') format('embedded-opentype'));

如链接Font-face as base64 with fallbacks所述,但未成功

0 个答案:

没有答案