服务器字体不在Internet Explorer中工作11

发布于 2025-02-10 07:57:20 字数 527 浏览 2 评论 0原文

我在网页上使用 @font-face进行更改字体。如果我使用带有字体的本地文件(从我的PC fort for from pc )看起来像这样:所需的字体。但是,如果我尝试从同一目录中使用服务器文件(服务器字体文件route )字体我在 Standart font

I use @font-face on my web page for change font. If i use local files with fonts(route for font from my pc), all work fine font look like this: needed font . But if I try to use server file from same directory(server font file route) IE received this font I see it in dev tool but font not working and looks like standart font

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凡尘雨 2025-02-17 07:57:20

我找不到好的解决方案,但是我修复了此答案中使用了base64转换器:转换和渲染Web字体为base64-保持原始外观

转换器:

function base64convert (files) {
  console.clear()
  const reader = new FileReader()
  reader.onload = (e) => {
    console.log(e.target.result)
  }
  reader.readAsDataURL(files[0])
}
<input type="file" onchange="base64convert(this.files)">

并将我的TTF字体文件作为base64字符串。

@font-face {
    font-family: 'myfont';
    src: url("<<copied base64 string>>");
}

I not found good solution, but I fixed it used base64 converter from this answer: Converting and rendering web fonts to base64 - keep original look

Converter:

function base64convert (files) {
  console.clear()
  const reader = new FileReader()
  reader.onload = (e) => {
    console.log(e.target.result)
  }
  reader.readAsDataURL(files[0])
}
<input type="file" onchange="base64convert(this.files)">

And included my ttf font file as base64 string.

@font-face {
    font-family: 'myfont';
    src: url("<<copied base64 string>>");
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文