gpt4 book ai didi

html - 在页面另存为时包含@font-face

转载 作者:可可西里 更新时间:2023-11-01 14:52:21 25 4
gpt4 key购买 nike

我可以使用@font-face 嵌入自定义字体。但是当页面保存在我的电脑上以本地方式查看时,字体没有保存。
我在 Firefox、Chrome 和 Safari 上试过了。问题总是一样的。

如何强制嵌入字体并将页面另存为?

最佳答案

谢谢@PartiallyFinite,就是这个主意!

url 调用的顺序很重要,所以我发布了我的@font-face css 属性:

@font-face {
font-family: "my_custom_font";
src: url('my_custom_font.eot');
src: url('my_custom_font.eot?#iefix') format('embedded-opentype'),
url(data:font/truetype;charset=utf-8;base64,AAA...AAA=) format('truetype'),
url('my_custom_font.woff') format('woff'),
url('my_custom_font.ttf') format('truetype'),
url('my_custom_font.otf') format("opentype"),
url('my_custom_font.svg#my_custom_font') format('svg');
font-weight: normal;
font-style: normal;
font-variant:normal;
}

注意事项:
url(data:font/truetype) 必须在 .woff 之前所以 firefox 使用 base64 而不是 .woff

在 Firefox 20.0、Google Chrome 26.0.1410.65、Safari 6.0 上测试。

关于html - 在页面另存为时包含@font-face,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16502764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com