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 fdf20b7313
commit c0310a0a41
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -196,4 +196,8 @@ enum {
#define NS_FONT_VARIANT_POSITION_SUPER 1 #define NS_FONT_VARIANT_POSITION_SUPER 1
#define NS_FONT_VARIANT_POSITION_SUB 2 #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 #endif