mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 21:18:35 +00:00
#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:
parent
c93a07a28f
commit
444c5238f4
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user