diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2013-05-13 16:32:20 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2013-05-13 16:35:38 +0200 |
commit | dd5b15ebd868e21b4c948ccb7978136a91a7992c (patch) | |
tree | aa284cd3e18019a8f56afce08ef05301befac8db /vcl | |
parent | 3c480196dd66df48f8ab637a2ac26ffbca328063 (diff) |
Handle fonts without hhea or OS/2 table e.g. Type1
Change-Id: Ib7245e9f8b7874087966cb1098e63d1f83acaa6a
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/glyphs/gcach_ftyp.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index bd1ef2690062..162ba1108eea 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -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) ) |