Commit 375bca6d authored by Andrea Iacovitti's avatar Andrea Iacovitti

Really cache font's xHeight.

parent a981105a
......@@ -1089,11 +1089,9 @@ double CSSPrimitiveValueImpl::computeLengthFloat( khtml::RenderStyle *style, int
case CSSPrimitiveValue::CSS_EMS:
factor = style->font().pixelSize();
break;
case CSSPrimitiveValue::CSS_EXS: {
const QFontMetrics fm = style->fontMetrics();
factor = fm.xHeight();
case CSSPrimitiveValue::CSS_EXS:
factor = style->htmlFont().xHeight();
break;
}
case CSSPrimitiveValue::CSS_CHS: {
const int zw = style->htmlFont().zeroCharWidth();
if (zw != -1) {
......
......@@ -580,6 +580,7 @@ CachedFontInstance::CachedFontInstance(CachedFontFamily* p, int sz):
descent = fm.descent();
height = fm.height();
lineSpacing = fm.lineSpacing();
xHeight = fm.xHeight();
const QChar zeroChar((ushort)48);
if (!fm.inFont(zeroChar)) {
......@@ -609,6 +610,7 @@ void CachedFontInstance::invalidate()
descent = fm.descent();
height = fm.height();
lineSpacing = fm.lineSpacing();
xHeight = fm.xHeight();
const QChar zeroChar((ushort)48);
if (!fm.inFont(zeroChar)) {
......
......@@ -82,6 +82,7 @@ public:
int descent;
int height;
int lineSpacing;
int xHeight;
int m_zeroCharWidth;
mutable bool invalidated;
......@@ -241,7 +242,7 @@ public:
int descent() const { return cfi->descent; }
int height() const { return cfi->height; }
int lineSpacing() const { return cfi->lineSpacing; }
float xHeight() const { return cfi->fm.xHeight(); }
int xHeight() const { return cfi->xHeight; }
// return -1 if '0' char glyph not in font
int zeroCharWidth() const { return cfi->m_zeroCharWidth; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment