#130091 should we get rid of "NEW_FONT_HEIGHT_APIS"

r=Roland.Mainz@informatik.med.uni-giessen.de, sr=rbs
This commit is contained in:
shanjian%netscape.com 2002-09-18 19:37:31 +00:00
parent c93a07a28f
commit 444c5238f4
3 changed files with 5 additions and 32 deletions

View File

@ -143,18 +143,6 @@ public:
#define FONT_LEADING_APIS_V2 1
#endif
#if defined(XP_UNIX) || defined(XP_PC) || defined(XP_MAC) || defined(XP_BEOS)
#define NEW_FONT_HEIGHT_APIS 1
#endif
#ifdef NEW_FONT_HEIGHT_APIS
#ifndef FONT_LEADING_APIS_V2
/**
* Returns the normal line height (em height + leading).
*/
NS_IMETHOD GetNormalLineHeight(nscoord &aHeight) = 0;
#endif /* not FONT_LEADING_APIS_V2 */
#endif /* NEW_FONT_HEIGHT_APIS */
#ifdef FONT_LEADING_APIS_V2
/**
* Returns the amount of internal leading (in app units) for the font. This
@ -174,9 +162,12 @@ public:
* is computed as the "height - (ascent + descent)"
*/
NS_IMETHOD GetLeading(nscoord &aLeading) = 0;
#endif /* FONT_LEADING_APIS_V2 */
#ifdef NEW_FONT_HEIGHT_APIS
/**
* Returns the normal line height (em height + leading).
*/
NS_IMETHOD GetNormalLineHeight(nscoord &aHeight) = 0;
#endif /* FONT_LEADING_APIS_V2 */
/**
* Returns the height (in app units) of the Western font's em square. This is
@ -200,8 +191,6 @@ public:
*/
NS_IMETHOD GetMaxHeight(nscoord &aHeight) = 0;
#endif /* NEW_FONT_HEIGHT_APIS */
/**
* Returns, in app units, the maximum distance characters in this font extend
* above the base line.

View File

@ -2264,7 +2264,6 @@ nsHTMLReflowState::UseComputedHeight()
return useComputedHeight;
}
#ifdef NEW_FONT_HEIGHT_APIS
#define NORMAL_LINE_HEIGHT_FACTOR 1.2f // in term of emHeight
// For "normal" we use the font's normal line height (em height + leading).
// If both internal leading and external leading specified by font itself
@ -2305,7 +2304,6 @@ GetNormalLineHeight(nsIFontMetrics* aFontMetrics)
#endif // FONT_LEADING_APIS_V2
return normalLineHeight;
}
#endif // NEW_FONT_HEIGHT_APIS
static nscoord
ComputeLineHeight(nsIPresContext* aPresContext,
@ -2349,20 +2347,16 @@ ComputeLineHeight(nsIPresContext* aPresContext,
// little hack lets us override that behavior to allow for more
// precise layout in the face of imprecise fonts.
nscoord emHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
if (!nsHTMLReflowState::UseComputedHeight()) {
fm->GetEmHeight(emHeight);
}
#endif
lineHeight = NSToCoordRound(factor * emHeight);
} else {
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
lineHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
if (!nsHTMLReflowState::UseComputedHeight()) {
lineHeight = GetNormalLineHeight(fm);
}
#endif
}
}
return lineHeight;
@ -2391,11 +2385,9 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
SetFontFromStyle(aRenderingContext, sc);
nsCOMPtr<nsIFontMetrics> fm;
aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
#ifdef NEW_FONT_HEIGHT_APIS
if (fm) {
lineHeight = GetNormalLineHeight(fm);
}
#endif
}
}
return lineHeight;

View File

@ -2264,7 +2264,6 @@ nsHTMLReflowState::UseComputedHeight()
return useComputedHeight;
}
#ifdef NEW_FONT_HEIGHT_APIS
#define NORMAL_LINE_HEIGHT_FACTOR 1.2f // in term of emHeight
// For "normal" we use the font's normal line height (em height + leading).
// If both internal leading and external leading specified by font itself
@ -2305,7 +2304,6 @@ GetNormalLineHeight(nsIFontMetrics* aFontMetrics)
#endif // FONT_LEADING_APIS_V2
return normalLineHeight;
}
#endif // NEW_FONT_HEIGHT_APIS
static nscoord
ComputeLineHeight(nsIPresContext* aPresContext,
@ -2349,20 +2347,16 @@ ComputeLineHeight(nsIPresContext* aPresContext,
// little hack lets us override that behavior to allow for more
// precise layout in the face of imprecise fonts.
nscoord emHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
if (!nsHTMLReflowState::UseComputedHeight()) {
fm->GetEmHeight(emHeight);
}
#endif
lineHeight = NSToCoordRound(factor * emHeight);
} else {
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
lineHeight = font->mFont.size;
#ifdef NEW_FONT_HEIGHT_APIS
if (!nsHTMLReflowState::UseComputedHeight()) {
lineHeight = GetNormalLineHeight(fm);
}
#endif
}
}
return lineHeight;
@ -2391,11 +2385,9 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
SetFontFromStyle(aRenderingContext, sc);
nsCOMPtr<nsIFontMetrics> fm;
aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
#ifdef NEW_FONT_HEIGHT_APIS
if (fm) {
lineHeight = GetNormalLineHeight(fm);
}
#endif
}
}
return lineHeight;