我使用自定义字体创建了一个网页,我可以看到浏览器中应用的字体,但未在打印页面中应用。
我按照以下方式进行打印:
fonttest.css文件包含以下内容:
@font-face {
font-family: "myriad";
src: url("../fonts/myriad.otf") format('truetype');
}
@font-face {
font-family: "serifa-bold";
src: url("../fonts/serifa_bold.ttf") format('truetype');
}
@font-face {
font-family: "serifa";
src: url("../fonts/serifa.ttf") format('truetype');
}
@font-face {
font-family: "AlexandriaFLF";
src: url("../fonts/AlexandriaFLF.ttf") format('truetype');
}
@font-face {
font-family: "AlexandriaFLF-Bold";
src: url("../fonts/AlexandriaFLF-Bold.ttf") format('truetype');
}
@font-face {
font-family: "AlexandriaFLF-BoldItalic";
src: url("../fonts/AlexandriaFLF-BoldItalic.ttf") format('truetype');
}
@font-face {
font-family: "AlexandriaFLF-Italic";
src: url("../fonts/AlexandriaFLF-Italic.ttf") format('truetype');
}
在HTML文件中,CSS文件链接如下:
<link rel='stylesheet' type='text/css' media='all' href='resource/css/fonttest.css' />
我正在打印以下几行:
<p style="font-family:myriad;color:#000000">myriad-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p>
<p style="font-family:serifa-bold;color:#000000">serifa-bold-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p>
<p style="font-family:serifa;color:#000000">serifa-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p>
<p style="font-family:AlexandriaFLF;color:#000000">AlexandriaFLF-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p>
<p style="font-family:AlexandriaFLF-Italic;color:#000000">AlexandriaFLF-Italic-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p>
<p style="font-family:AlexandriaFLF-Bold;color:#000000">AlexandriaFLF-Bold-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p>
<p style="font-family:AlexandriaFLF-BoldItalic;color:#000000">AlexandriaFLF-BoldItalic-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p>
请帮帮我?
答案 0 :(得分:1)
如果你找不到办法,可以选择其他方法。
您可以使用wkhtml2pdf制作可打印的PDF文件。
答案 1 :(得分:0)
尝试将样式表媒体属性设置为打印:
<link rel='stylesheet' type='text/css' media='print' href='resource/css/fonttest.css' />
答案 2 :(得分:0)
也许您可能需要在css中包含更多字体格式。 像这样:
@font-face {
font-family: 'XXXXX';
src: url('XXXXX.eot');
src: url('XXXXX.eot?#iefix') format('embedded-opentype'),
url('XXXXX.woff') format('woff'),
url('XXXXX.ttf') format('truetype'),
url('XXXXX.svg#XXXXX') format('svg');
font-weight: normal;
font-style: normal;
}
答案 3 :(得分:0)
网址https://bugzilla.mozilla.org/show_bug.cgi?id=468568解释了为什么打印不适用于自定义字体,因此我在firefox-20.0a1.en-US.win32.installer.exe
进行了测试。使用ttf和otf的字体应该完全应用。