RE: [CSS3-text] pixel positioning of underline (was text-underline-position and superscript

For your information, I investigated some fonts I have in my Win7 box.



# I'm using table here, forgive me to use HTML mail for who don't like it


Name

TypoAscender

TypoDescender

ulPos

ulThickness

ulBottom

MSGothic

220

-36

-17

19

0

Meiryo

1798

-250

-205

102

-57

KozGoPro-Regular

880

-120

-75

50

-5

HGRGM

220

-36

-17

19

0

mingliu

820

-204

-110

50

44

gulim

879

-145

-97

67

-19




First two fields are from 'os/2' table<http://www.microsoft.com/typography/otspec/os2.htm>, and ulPos/ulThickness are from 'post' table<http://www.microsoft.com/typography/otspec/post.htm>. The ulBottom is calculated as [ulPos]-[ulThickness]-[TypoDescender], which means the bottom of underline (0=at the bottom of the em-box, positive=closer to baseline, negative=below the bottom of em-box).



It looks like most fonts have good values, while mingliu is slightly closer to baseline than others. I haven't looked into glyphs, so I'm not sure if this is "too close" or not though.



This data also indicates that the current definition of text-underline-position:under<http://dev.w3.org/csswg/css3-text/#text-underline-position> is pretty close to what font designers want, so if the font you want to use has incorrect data, using the value might help you from "underline too close to the baseline" issue.





-----Original Message-----
From: Koji Ishii
Sent: Sunday, December 26, 2010 8:29 PM
To: 'Ambrose LI'; Belov, Charles
Cc: www-style@w3.org
Subject: [CSS3-text] pixel positioning of underline (was text-underline-position and superscript



Since you raised yet another topic, I'm separating the thread.



> The underlines are often, if not always, too close to the baseline,

> causing the underline to intersect with the Chinese characters.

> So "pixel positioning" would be a good idea since it would be a way to

> correct this typographical error.



The issue you're talking about is because most CJK fonts have wrong information for the underline position, and browsers use that information (I suppose). 10 years ago, I investigated several Japanese fonts and none of them had correct information. Today, I can see some recent Japanese fonts have good information in 'post' header. One thing you could do in long term is to talk to font vendors and let them fix it. You will get the correct underline automatically then.



If recent Chinese fonts are still wrong, next thing you could do is to talk to browser vendors and let them implement a hack--that is, not to trust the font information and use hard-coded value for CJK fonts. It works in most cases because CJK fonts do not need to change underline position as often as Latin fonts does. It's a hack, most browser vendors might hate it though.



The last resolution for you is to use text-underline-position:under[1]. This is already spec'ed, so you will be able to use it when the spec goes to CR or REC and browsers support it.



[1] http://dev.w3.org/csswg/css3-text/#text-underline-position





Regards,

Koji

Received on Monday, 27 December 2010 07:20:56 UTC