从Google Chrome打印网络字体时显示的垃圾字符 [英] Garbage character displayed while printing web fonts from Google Chrome

查看:219
本文介绍了从Google Chrome打印网络字体时显示的垃圾字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从Google chrome v 18打印Web字体时遇到问题,但是在IE和Firefox上可以正常使用,我正在使用CSS文件来传递Web字体,其代码如下.

I have a problem with printing web fonts from Google chrome v 18 but it works totally fine with IE and Firefox, I am using CSS file to pass the web fonts and the code for it is as follows.

@font-face {

font-family: 'C39P24DmTtNormal';
src: url('WebFonts/v100025_-webfont.eot');
src: url('WebFonts/v100025_-webfont.eot?#iefix') format('embedded-opentype'),
     url('WebFonts/v100025_-webfont.woff') format('woff'),
     url('WebFonts/v100025_-webfont.ttf') format('truetype'),
     url('WebFonts/v100025_-webfont.svg#C39P24DmTtNormal') format('svg');

font-weight: normal;
font-style: normal;
}

问题屏幕截图:

图片描述:

在上面的屏幕截图中,所有用红色标记的是CSS文件中网络字体提供的条形码,但在打印时如上所述.

In the above screen-shot all the ones marked in red are the bar-codes provided by the web fonts in CSS file but while printing are shown as above.

我尝试在Google上进行搜索,但似乎是 Chrome可能存在的错误,他们正尝试尽快对其进行修复.

I tried to search on Google, but it seems to be a possible bug with Chrome and they are trying to fix it as soon as they can.

有什么变通办法可以帮助我,因为我不希望客户在他们用来浏览Web应用程序的每台计算机上安装字体.

Is there any kind of workaround that can help me as I don't want my clients to install the fonts on each and every computer they use to browse my web application.

推荐答案

我也遇到了相同的问题,即从设置中禁用打印预览,但在Google Chrome中却存在问题.它不允许在打印之前加载网络字体,因此只需将其重新启用即可.

I also had the same problem of disabled print preview from the settings but the problem in Google Chrome. It does not allow the web fonts to get loaded before printing, so just enable it back.

如果在body.onLoad上使用Windows.print,则将其删除是其真正的问题原因.只有Internet Explorer支持此功能,而Google Chrome浏览器不支持.

If you are using Windows.print on body.onLoad then remove that as its the real cause of the problem. This is only supported by Internet Explorer and not Google Chrome.

示例:

<body onload="window.print();">

删除onload,我希望它能解决问题.如果您尝试过此操作,那么对不起.

Remove the onload and I hope it does the trick. If you have tried this then I am sorry.

这篇关于从Google Chrome打印网络字体时显示的垃圾字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆