W3C home > Mailing lists > Public > www-international@w3.org > July to September 2012

The :lang() selector and font-size in %

From: Najib Tounsi <ntounsi@emi.ac.ma>
Date: Wed, 19 Sep 2012 14:31:34 +0100
Message-ID: <5059C936.8060604@emi.ac.ma>
To: Richard Ishida <ishida@w3.org>
CC: 'WWW International' <www-international@w3.org>
Dear Richard, all

Presentation styles are commonly used to control changes in fonts, font 
sizes etc. when language changes occur in the document.
In "Styling using language attributes" 
(http://www.w3.org/International/questions/qa-css-lang.en.php) the first 
example:

em           { font-style: italic; }
em:lang(ja)  { font-style: normal; font-emphasize: dot before; }

<p>This is <em>English</em>, but <span lang="ja">これは<em>日本語</em>で 
す。</span></p>

shows the advantage of :lang() vs *[lang=".."].

But the :lang() selector has also a disadvantage against *[lang=".."]. 
In the following (similar) example:

:lang(fr) { font-style: italic; font-size:130%; }

<p>This is <em>English</em>, but <span lang="fr">ceci est 
<em>Français</em>, non?</span></p>

the word Français will be italicized, OK, but amplified 130% twice! (And 
as much as there are nested elements. Imagine <em><a 
...>Français</a></em>). Here, *[lang="fr"] selector would be more 
appropriate.

I think the article above should also mention this point, because 
styling to accommodate language change is mainly about font-size.


I often use the lang attribute in styling to better harmonize the look 
(font-size) when some Arabic and Latin fonts are mixed. My preferred 
Arabic fonts ("Al Bayan" or "Traditional Arabic") look smaller.

Regards,

Najib

--
Najib TOUNSI (tounsi at w3.org)
W3C Office in Morocco (http://www.w3c.org.ma/)
Ecole Mohammadia d'Ingénieurs, BP. 765 Agdal-RABAT Morocco
Tel: +212 (0) 537 77.05.98 Mobile: +212 (0) 661 22 00 30
Received on Wednesday, 19 September 2012 13:29:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 19 September 2012 13:29:01 GMT