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

Khaled Hosny khaledhosny at eglug.org
Tue Nov 29 13:38:59 UTC 2016


 vcl/unx/generic/print/genpspgraphics.cxx |   30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

New commits:
commit 63ca9554f24194521cfbc7fa90bfef37ea7759c1
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Tue Nov 29 08:25:57 2016 +0200

    Use Freetypefont::GetFontMetric()
    
    Change-Id: I1c0d2bc228d5b2006bba24621be3a75f61f4432b
    Reviewed-on: https://gerrit.libreoffice.org/31345
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 7bedffe..a3db611 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -774,33 +774,13 @@ void GenPspGraphics::ClearDevFontCache()
     GlyphCache::GetInstance().ClearFontCache();
 }
 
-void GenPspGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int )
+void GenPspGraphics::GetFontMetric(ImplFontMetricDataRef& rxFontMetric, int nFallbackLevel)
 {
-    const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
-    psp::PrintFontInfo aInfo;
+    if (nFallbackLevel >= MAX_FALLBACK)
+        return;
 
-    if (rMgr.getFontInfo (m_pPrinterGfx->GetFontID(), aInfo))
-    {
-        FontAttributes aDFA = Info2FontAttributes( aInfo );
-        static_cast< FontAttributes& >(*rxFontMetric) = aDFA;
-        rxFontMetric->SetBuiltInFontFlag( aDFA.IsBuiltInFont() );
-        rxFontMetric->SetScalableFlag( true );
-        rxFontMetric->SetTrueTypeFlag( false ); // FIXME, needed?
-
-        rxFontMetric->SetOrientation( m_pPrinterGfx->GetFontAngle() );
-        rxFontMetric->SetSlant( 0 );
-
-        sal_Int32 nTextHeight   = m_pPrinterGfx->GetFontHeight();
-        sal_Int32 nTextWidth    = m_pPrinterGfx->GetFontWidth();
-        if( ! nTextWidth )
-            nTextWidth = nTextHeight;
-
-        rxFontMetric->SetWidth( nTextWidth );
-        rxFontMetric->SetAscent( ( aInfo.m_nAscend * nTextHeight + 500 ) / 1000 );
-        rxFontMetric->SetDescent( ( aInfo.m_nDescend * nTextHeight + 500 ) / 1000 );
-        rxFontMetric->SetInternalLeading( ( aInfo.m_nLeading * nTextHeight + 500 ) / 1000 );
-        rxFontMetric->SetExternalLeading( 0 );
-    }
+    if (m_pFreetypeFont[nFallbackLevel])
+        m_pFreetypeFont[nFallbackLevel]->GetFontMetric(rxFontMetric);
 }
 
 bool GenPspGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )


More information about the Libreoffice-commits mailing list