Handle fonts without hhea or OS/2 table e.g. Type1

Change-Id: Ib7245e9f8b7874087966cb1098e63d1f83acaa6a
This commit is contained in:
Khaled Hosny 2013-05-13 16:32:20 +02:00
parent 3c480196dd
commit dd5b15ebd8

View File

@ -945,8 +945,10 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const
// Calculating ascender and descender:
// FreeType >= 2.4.6 does the right thing, so we just use what it gives us,
// for earlier versions we emulate its behaviour; take them from 'hhea'
// table, if zero take them from 'OS/2' table.
// for earlier versions we emulate its behaviour;
// take them from 'hhea' table,
// if zero take them from 'OS/2' table,
// if zero take them from FreeType's font metrics
if (nFTVERSION >= 2406)
{
const FT_Size_Metrics& rMetrics = maFaceFT->size->metrics;
@ -982,6 +984,14 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const
}
}
}
if (!(rTo.mnAscent || rTo.mnDescent))
{
const FT_Size_Metrics& rMetrics = maFaceFT->size->metrics;
rTo.mnAscent = (rMetrics.ascender + 32) >> 6;
rTo.mnDescent = (-rMetrics.descender + 32) >> 6;
rTo.mnExtLeading = ((rMetrics.height + 32) >> 6) - (rTo.mnAscent + rTo.mnDescent);
}
}
if( pOS2 && (pOS2->version != 0xFFFF) )