Bug 383547. Convert font height, ascent, descent and max-advance to integers conservatively. r=pavlov

This commit is contained in:
roc+@cs.cmu.edu 2007-06-10 16:04:27 -07:00
Родитель a3cf44e135
Коммит 634328ee72
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -102,6 +102,7 @@ nsThebesFontMetrics::Destroy()
// XXXTODO get rid of this macro
#define ROUND_TO_TWIPS(x) (nscoord)floor(((x) * mP2A) + 0.5)
#define CEIL_TO_TWIPS(x) (nscoord)NS_ceil((x) * mP2A)
const gfxFont::Metrics& nsThebesFontMetrics::GetMetrics() const
{
@ -149,7 +150,8 @@ nsThebesFontMetrics::GetUnderline(nscoord& aOffset, nscoord& aSize)
NS_IMETHODIMP
nsThebesFontMetrics::GetHeight(nscoord &aHeight)
{
aHeight = ROUND_TO_TWIPS(GetMetrics().maxHeight);
aHeight = CEIL_TO_TWIPS(GetMetrics().maxAscent) +
CEIL_TO_TWIPS(GetMetrics().maxDescent);
return NS_OK;
}
@ -191,28 +193,29 @@ nsThebesFontMetrics::GetEmDescent(nscoord &aDescent)
NS_IMETHODIMP
nsThebesFontMetrics::GetMaxHeight(nscoord &aHeight)
{
aHeight = ROUND_TO_TWIPS(GetMetrics().maxHeight);
aHeight = CEIL_TO_TWIPS(GetMetrics().maxAscent) +
CEIL_TO_TWIPS(GetMetrics().maxDescent);
return NS_OK;
}
NS_IMETHODIMP
nsThebesFontMetrics::GetMaxAscent(nscoord &aAscent)
{
aAscent = ROUND_TO_TWIPS(GetMetrics().maxAscent);
aAscent = CEIL_TO_TWIPS(GetMetrics().maxAscent);
return NS_OK;
}
NS_IMETHODIMP
nsThebesFontMetrics::GetMaxDescent(nscoord &aDescent)
{
aDescent = ROUND_TO_TWIPS(GetMetrics().maxDescent);
aDescent = CEIL_TO_TWIPS(GetMetrics().maxDescent);
return NS_OK;
}
NS_IMETHODIMP
nsThebesFontMetrics::GetMaxAdvance(nscoord &aAdvance)
{
aAdvance = ROUND_TO_TWIPS(GetMetrics().maxAdvance);
aAdvance = CEIL_TO_TWIPS(GetMetrics().maxAdvance);
return NS_OK;
}