在IE,Chrome中显示为框的Unicode HTML标题 [英] Unicode HTML titles displaying as boxes in IE, Chrome

查看:100
本文介绍了在IE,Chrome中显示为框的Unicode HTML标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的HTML(另请参阅 http://www.caudillweb.com/test/test .htm )。

 <!DOCTYPE html> 
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8>
< title>日历< / title>
< / head>
< body>
< h1>日历< / h1>
< / body>
< / html>

以下是我在IE,Chrome和Firefox中分别看到的内容(请注意页面标题): p>







(Safari也显示框,如IE和Chrome)。在Firefox中,标题显示正确。为什么我在其他浏览器中使用框?

解决方案

在IE和Chrome中,标题栏和标签由标准的OS窗口控件绘制。因此,它们使用操作系统选择的可用字体和字体回退机制来呈现,而不是用于页内内容(*)的Web浏览器的字体呈现器。



Web浏览器字体呈现在寻找不同字符的回退字体方面比较保守的OS字体呈现方式更好。



Firefox是不同的,因为它实现了用户界面它自己的窗口小部件代码(XUL),而不是使用本地操作系统控件。

然而,您的测试页面的标题在香草Windows 7安装中适合我,使用中文字体是默认安装的。您可能会选择导致失败的已安装字体(并且Firefox在该选项卡中使用非ClearType字体)。



(*:某些浏览器可能会使用一些页面内容的操作系统部件,通常是< select> 元素,然后会遇到同样的问题。)


Here's my HTML (see also http://www.caudillweb.com/test/test.htm ).

<!DOCTYPE html >
<html>
  <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
     <title>日历</title>
   </head>
   <body>
      <h1>日历</h1>
   </body>
</html>

Here's what I see in IE, Chrome, and Firefox respectively (note the page title):

(Safari also displays boxes, like IE and Chrome.) In Firefox the title shows up correctly. Why am I getting boxes in the other browsers?

解决方案

In IE and Chrome, the title bar and tabs are drawn by the standard OS window controls. As such they are rendered with the OS's selection of available fonts and font-fallback mechanisms, instead of the web browser's font renderer that is used for in-page content(*).

Web browser font rendering tends to be better at finding fallback fonts for different characters than the more conservative OS font rendering.

Firefox is different because it implements the user interface using its own widget code (XUL) instead of using native OS controls.

However your test page's title renders fine for me in a vanilla Windows 7 install, using the Chinese fonts that are installed by default. There may be something about your selection of installed fonts that causes the failure (and Firefox using a non-ClearType font in that tab).

(*: some browsers may use OS widgets for some in-page content, typically the <select> element. This then suffers from the same problem.)

这篇关于在IE,Chrome中显示为框的Unicode HTML标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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