|
|
http://www.mozilla.org/projects/intl/fonts.html
Another problem is Unicode's Han unification. Unicode uses one set of characters for Chinese, Japanese, Korean and other Han languages. How do we know which font to use if the document is in Unicode? One way is to use HTML's LANG attribute. If the attribute for a particular span of text says "ja", then we can use a Japanese font for that span.
- <html dir="ltr" lang="zh">
复制代码
摘自论坛页面代码,这个是一直存在的吧?
根据LANG的的值选择合适的字体,似乎是不错的办法,但Opera和Konqueror似乎都没有这么做。
LANG
The LANG attribute specifies the language of an element's attribute values and its content, including all contained elements that do not specify their own LANG attribute. While the LANG attribute is not widely supported, its use may help search engines index a document by its language while allowing speech synthesizers to use language-dependent pronunciation rules. As well, visual browsers can use the language's proper quotation marks when rendering the Q element.
The attribute value is case-insensitive, and should be specified according to RFC 1766; examples include en for English, en-US for American English, and ja for Japanese. Whitespace is not allowed in the language code.
Use of the LANG attribute also allows authors to easily change the style of text depending on the language. For example, a bilingual document may have one language in italics if rendered visually or a different voice if rendered aurally. The HTML of such a document might be as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<TITLE>Welcome - Bienvenue</TITLE>
<H1>
<SPAN LANG=en>Welcome</SPAN> -
<SPAN LANG=fr>Bienvenue</SPAN>
</H1>
< LANG=en>This paragraph is in English.</P>
< LANG=fr>Ce paragraphe est en français.</P>
...
A document's primary language may be set using the LANG attribute on the HTML element, or, alternatively, by using the Content-Language HTTP header. |
|