Bug 1029307 - use fixed subscript/superscript offset ratio instead of font metric values. r=heycam

This commit is contained in:
John Daggett 2014-06-28 15:40:35 +09:00
parent 9c0a2214db
commit 1e79307a4f
2 changed files with 8 additions and 2 deletions

View File

@ -162,13 +162,15 @@ nsFontMetrics::XHeight()
nscoord
nsFontMetrics::SuperscriptOffset()
{
return ROUND_TO_TWIPS(GetMetrics().superscriptOffset);
return ROUND_TO_TWIPS(GetMetrics().emHeight *
NS_FONT_SUPERSCRIPT_OFFSET_RATIO);
}
nscoord
nsFontMetrics::SubscriptOffset()
{
return ROUND_TO_TWIPS(GetMetrics().subscriptOffset);
return ROUND_TO_TWIPS(GetMetrics().emHeight *
NS_FONT_SUBSCRIPT_OFFSET_RATIO);
}
void

View File

@ -196,4 +196,8 @@ enum {
#define NS_FONT_VARIANT_POSITION_SUPER 1
#define NS_FONT_VARIANT_POSITION_SUB 2
// based on fixed offset values used within WebKit
#define NS_FONT_SUBSCRIPT_OFFSET_RATIO (0.20)
#define NS_FONT_SUPERSCRIPT_OFFSET_RATIO (0.34)
#endif