Fixed leading. Simplified a bit the code

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12591 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2005-05-07 17:32:43 +00:00
parent fb52610b82
commit 09cbe37854

View File

@ -53,14 +53,15 @@ FontStyle::FontStyle(const char *filepath, FT_Face face)
fbounds.Set(0,0,0,0);
fFace=TranslateStyleToFace(face->style_name);
fID=0;
fHeight.ascent=face->ascender;
fHeight.descent=face->descender;
fHeight.ascent = face->ascender;
// FT2's descent numbers are negative. Be's is positive
fHeight.descent = -face->descender;
// FT2 doesn't provide a linegap, but according to the docs, we can
// calculate it because height = ascending + descending + leading
fHeight.leading=face->height-( face->ascender + (face->descender>0)?
face->descender : face->descender * -1);
fHeight.units_per_em=face->units_per_EM;
fHeight.leading = face->height - (fHeight.ascent + fHeight.descent);
fHeight.units_per_em = face->units_per_EM;
}
/*!
@ -91,12 +92,9 @@ font_height FontStyle::GetHeight(const float &size)
// font units are 26.6 format, so we get REALLY big numbers if
// we don't do some shifting.
fh.ascent=(fHeight.ascent * size) / fHeight.units_per_em;
// FT2's descent numbers are negative. Be's is positive
fh.descent=(fHeight.descent * size * -1) / fHeight.units_per_em;
fh.leading=(fHeight.leading * size) / fHeight.units_per_em;
fh.ascent = (fHeight.ascent * size) / fHeight.units_per_em;
fh.descent = (fHeight.descent * size) / fHeight.units_per_em;
fh.leading = (fHeight.leading * size) / fHeight.units_per_em;
return fh;
}