[Libreoffice-commits] core.git: vcl/generic

Khaled Hosny khaledhosny at eglug.org
Mon May 13 07:36:19 PDT 2013


 vcl/generic/glyphs/gcach_ftyp.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit dd5b15ebd868e21b4c948ccb7978136a91a7992c
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon May 13 16:32:20 2013 +0200

    Handle fonts without hhea or OS/2 table e.g. Type1
    
    Change-Id: Ib7245e9f8b7874087966cb1098e63d1f83acaa6a

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index bd1ef26..162ba11 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) )


More information about the Libreoffice-commits mailing list