#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:
@@ -143,18 +143,6 @@ public:
|
|||||||
#define FONT_LEADING_APIS_V2 1
|
#define FONT_LEADING_APIS_V2 1
|
||||||
#endif
|
#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
|
#ifdef FONT_LEADING_APIS_V2
|
||||||
/**
|
/**
|
||||||
* Returns the amount of internal leading (in app units) for the font. This
|
* 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)"
|
* is computed as the "height - (ascent + descent)"
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetLeading(nscoord &aLeading) = 0;
|
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
|
* 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;
|
NS_IMETHOD GetMaxHeight(nscoord &aHeight) = 0;
|
||||||
|
|
||||||
#endif /* NEW_FONT_HEIGHT_APIS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns, in app units, the maximum distance characters in this font extend
|
* Returns, in app units, the maximum distance characters in this font extend
|
||||||
* above the base line.
|
* above the base line.
|
||||||
|
|||||||
@@ -2264,7 +2264,6 @@ nsHTMLReflowState::UseComputedHeight()
|
|||||||
return useComputedHeight;
|
return useComputedHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
#define NORMAL_LINE_HEIGHT_FACTOR 1.2f // in term of emHeight
|
#define NORMAL_LINE_HEIGHT_FACTOR 1.2f // in term of emHeight
|
||||||
// For "normal" we use the font's normal line height (em height + leading).
|
// For "normal" we use the font's normal line height (em height + leading).
|
||||||
// If both internal leading and external leading specified by font itself
|
// If both internal leading and external leading specified by font itself
|
||||||
@@ -2305,7 +2304,6 @@ GetNormalLineHeight(nsIFontMetrics* aFontMetrics)
|
|||||||
#endif // FONT_LEADING_APIS_V2
|
#endif // FONT_LEADING_APIS_V2
|
||||||
return normalLineHeight;
|
return normalLineHeight;
|
||||||
}
|
}
|
||||||
#endif // NEW_FONT_HEIGHT_APIS
|
|
||||||
|
|
||||||
static nscoord
|
static nscoord
|
||||||
ComputeLineHeight(nsIPresContext* aPresContext,
|
ComputeLineHeight(nsIPresContext* aPresContext,
|
||||||
@@ -2349,20 +2347,16 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||||||
// little hack lets us override that behavior to allow for more
|
// little hack lets us override that behavior to allow for more
|
||||||
// precise layout in the face of imprecise fonts.
|
// precise layout in the face of imprecise fonts.
|
||||||
nscoord emHeight = font->mFont.size;
|
nscoord emHeight = font->mFont.size;
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||||
fm->GetEmHeight(emHeight);
|
fm->GetEmHeight(emHeight);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
lineHeight = NSToCoordRound(factor * emHeight);
|
lineHeight = NSToCoordRound(factor * emHeight);
|
||||||
} else {
|
} else {
|
||||||
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
|
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
|
||||||
lineHeight = font->mFont.size;
|
lineHeight = font->mFont.size;
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||||
lineHeight = GetNormalLineHeight(fm);
|
lineHeight = GetNormalLineHeight(fm);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lineHeight;
|
return lineHeight;
|
||||||
@@ -2391,11 +2385,9 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
|
|||||||
SetFontFromStyle(aRenderingContext, sc);
|
SetFontFromStyle(aRenderingContext, sc);
|
||||||
nsCOMPtr<nsIFontMetrics> fm;
|
nsCOMPtr<nsIFontMetrics> fm;
|
||||||
aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
|
aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
if (fm) {
|
if (fm) {
|
||||||
lineHeight = GetNormalLineHeight(fm);
|
lineHeight = GetNormalLineHeight(fm);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lineHeight;
|
return lineHeight;
|
||||||
|
|||||||
@@ -2264,7 +2264,6 @@ nsHTMLReflowState::UseComputedHeight()
|
|||||||
return useComputedHeight;
|
return useComputedHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
#define NORMAL_LINE_HEIGHT_FACTOR 1.2f // in term of emHeight
|
#define NORMAL_LINE_HEIGHT_FACTOR 1.2f // in term of emHeight
|
||||||
// For "normal" we use the font's normal line height (em height + leading).
|
// For "normal" we use the font's normal line height (em height + leading).
|
||||||
// If both internal leading and external leading specified by font itself
|
// If both internal leading and external leading specified by font itself
|
||||||
@@ -2305,7 +2304,6 @@ GetNormalLineHeight(nsIFontMetrics* aFontMetrics)
|
|||||||
#endif // FONT_LEADING_APIS_V2
|
#endif // FONT_LEADING_APIS_V2
|
||||||
return normalLineHeight;
|
return normalLineHeight;
|
||||||
}
|
}
|
||||||
#endif // NEW_FONT_HEIGHT_APIS
|
|
||||||
|
|
||||||
static nscoord
|
static nscoord
|
||||||
ComputeLineHeight(nsIPresContext* aPresContext,
|
ComputeLineHeight(nsIPresContext* aPresContext,
|
||||||
@@ -2349,20 +2347,16 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||||||
// little hack lets us override that behavior to allow for more
|
// little hack lets us override that behavior to allow for more
|
||||||
// precise layout in the face of imprecise fonts.
|
// precise layout in the face of imprecise fonts.
|
||||||
nscoord emHeight = font->mFont.size;
|
nscoord emHeight = font->mFont.size;
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||||
fm->GetEmHeight(emHeight);
|
fm->GetEmHeight(emHeight);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
lineHeight = NSToCoordRound(factor * emHeight);
|
lineHeight = NSToCoordRound(factor * emHeight);
|
||||||
} else {
|
} else {
|
||||||
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
|
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
|
||||||
lineHeight = font->mFont.size;
|
lineHeight = font->mFont.size;
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||||
lineHeight = GetNormalLineHeight(fm);
|
lineHeight = GetNormalLineHeight(fm);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lineHeight;
|
return lineHeight;
|
||||||
@@ -2391,11 +2385,9 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
|
|||||||
SetFontFromStyle(aRenderingContext, sc);
|
SetFontFromStyle(aRenderingContext, sc);
|
||||||
nsCOMPtr<nsIFontMetrics> fm;
|
nsCOMPtr<nsIFontMetrics> fm;
|
||||||
aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
|
aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
|
||||||
#ifdef NEW_FONT_HEIGHT_APIS
|
|
||||||
if (fm) {
|
if (fm) {
|
||||||
lineHeight = GetNormalLineHeight(fm);
|
lineHeight = GetNormalLineHeight(fm);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lineHeight;
|
return lineHeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user