[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - vcl/inc vcl/source vcl/unx

Khaled Hosny khaledhosny at eglug.org
Thu Nov 24 06:47:04 UTC 2016


 vcl/inc/CommonSalLayout.hxx              |    2 -
 vcl/inc/unx/genpspgraphics.h             |    2 -
 vcl/source/gdi/CommonSalLayout.cxx       |    7 +++
 vcl/unx/generic/print/genpspgraphics.cxx |   61 +++++++++++++++++++++++++++----
 4 files changed, 64 insertions(+), 8 deletions(-)

New commits:
commit 04f89a0ed1da6b5555d671007b725bd49e740d0d
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Nov 23 21:42:47 2016 +0200

    Make PS on Unix printing use the new layout engine
    
    I’d rather kill PS printing entirely, but this will do for now.
    
    Change-Id: I112cc4855ab722ac07d31231f2a1ea8842b4159a
    Reviewed-on: https://gerrit.libreoffice.org/31133
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    (cherry picked from commit f337e95fb50c9edc10aca859aaf08baab5294d2e)
    Reviewed-on: https://gerrit.libreoffice.org/31140
    Tested-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/inc/CommonSalLayout.hxx b/vcl/inc/CommonSalLayout.hxx
index 31b9dca..e5345d7 100644
--- a/vcl/inc/CommonSalLayout.hxx
+++ b/vcl/inc/CommonSalLayout.hxx
@@ -64,7 +64,6 @@ class CommonSalLayout : public GenericSalLayout
 public:
 #if defined(_WIN32)
     explicit                CommonSalLayout(HDC, WinFontInstance&, const WinFontFace&);
-    void                    InitFont() const override { SelectObject(mhDC, mhFont); };
     const FontSelectPattern& getFontSelData() const { return mrFontSelData; };
 #elif defined(MACOSX) || defined(IOS)
     explicit                CommonSalLayout(const CoreTextStyle&);
@@ -74,6 +73,7 @@ public:
     const FreetypeFont&     getFontData() const { return mrFreetypeFont; };
 #endif
 
+    virtual void            InitFont() const override;
     void                    SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool);
     void                    AdjustLayout(ImplLayoutArgs&) override;
     bool                    LayoutText(ImplLayoutArgs&) override;
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index 1700267..792e44f 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -132,7 +132,7 @@ public:
     virtual bool            GetGlyphBoundRect( sal_GlyphId, Rectangle& ) override;
     virtual bool            GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) override;
     virtual SalLayout*      GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
-    virtual void            DrawSalLayout( const CommonSalLayout& ) override {};
+    virtual void            DrawSalLayout( const CommonSalLayout& ) override;
     virtual void            DrawServerFontLayout( const GenericSalLayout&, const FreetypeFont& ) override;
     virtual bool            supportsOperation( OutDevSupportType ) const override;
     virtual void            drawPixel( long nX, long nY ) override;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index cf6a53a..ea7093d 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -261,6 +261,13 @@ CommonSalLayout::CommonSalLayout(FreetypeFont& rFreetypeFont)
 }
 #endif
 
+void CommonSalLayout::InitFont() const
+{
+#if defined(_WIN32)
+    SelectObject(mhDC, mhFont);
+#endif
+}
+
 struct SubRun
 {
     int32_t mnMin;
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 0a7c849..b64ca91 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -57,6 +57,7 @@
 #include "PhysicalFontFace.hxx"
 #include "salbmp.hxx"
 #include "salprn.hxx"
+#include "CommonSalLayout.hxx"
 
 #include <config_graphite.h>
 #if ENABLE_GRAPHITE
@@ -695,9 +696,45 @@ void PspServerFontLayout::InitFont() const
                           mnOrientation, mbVertical, mbArtItalic, mbArtBold );
 }
 
+class PspCommonSalLayout : public CommonSalLayout
+{
+public:
+    PspCommonSalLayout(psp::PrinterGfx&, FreetypeFont& rFont);
+
+    virtual void        InitFont() const override;
+
+private:
+    ::psp::PrinterGfx&  mrPrinterGfx;
+    sal_IntPtr          mnFontID;
+    int                 mnFontHeight;
+    int                 mnFontWidth;
+    bool                mbVertical;
+    bool                mbArtItalic;
+    bool                mbArtBold;
+};
+
+PspCommonSalLayout::PspCommonSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rFont)
+:   CommonSalLayout(rFont)
+,   mrPrinterGfx(rGfx)
+{
+    mnFontID     = mrPrinterGfx.GetFontID();
+    mnFontHeight = mrPrinterGfx.GetFontHeight();
+    mnFontWidth  = mrPrinterGfx.GetFontWidth();
+    mbVertical   = mrPrinterGfx.GetFontVertical();
+    mbArtItalic  = mrPrinterGfx.GetArtificialItalic();
+    mbArtBold    = mrPrinterGfx.GetArtificialBold();
+}
+
+void PspCommonSalLayout::InitFont() const
+{
+    CommonSalLayout::InitFont();
+    mrPrinterGfx.SetFont(mnFontID, mnFontHeight, mnFontWidth,
+                         mnOrientation, mbVertical, mbArtItalic, mbArtBold);
+}
+
 static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx, bool bIsPspServerFontLayout )
 {
-    const int nMaxGlyphs = 200;
+    const int nMaxGlyphs = 1;
     sal_GlyphId aGlyphAry[ nMaxGlyphs ];
     DeviceCoordinate aWidthAry[ nMaxGlyphs ];
     sal_Int32   aIdxAry  [ nMaxGlyphs ];
@@ -767,6 +804,11 @@ void GenPspGraphics::DrawServerFontLayout( const GenericSalLayout& rLayout, cons
     DrawPrinterLayout( rLayout, *m_pPrinterGfx, true );
 }
 
+void GenPspGraphics::DrawSalLayout(const CommonSalLayout& rLayout)
+{
+    DrawPrinterLayout(rLayout, *m_pPrinterGfx, false);
+}
+
 const FontCharMapRef GenPspGraphics::GetFontCharMap() const
 {
     if( !m_pFreetypeFont[0] )
@@ -992,15 +1034,22 @@ SalLayout* GenPspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
     if( m_pFreetypeFont[ nFallbackLevel ]
         && !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) )
     {
-#if ENABLE_GRAPHITE
-        // Is this a Graphite font?
-        if (GraphiteServerFontLayout::IsGraphiteEnabledFont(*m_pFreetypeFont[nFallbackLevel]))
+        if (SalLayout::UseCommonLayout())
         {
-            pLayout = new GraphiteServerFontLayout(*m_pFreetypeFont[nFallbackLevel]);
+                pLayout = new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel]);
         }
         else
+        {
+#if ENABLE_GRAPHITE
+            // Is this a Graphite font?
+            if (GraphiteServerFontLayout::IsGraphiteEnabledFont(*m_pFreetypeFont[nFallbackLevel]))
+            {
+                pLayout = new GraphiteServerFontLayout(*m_pFreetypeFont[nFallbackLevel]);
+            }
+            else
 #endif
-            pLayout = new PspServerFontLayout( *m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel], rArgs );
+                pLayout = new PspServerFontLayout( *m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel], rArgs );
+        }
     }
     else
         pLayout = new PspFontLayout( *m_pPrinterGfx );


More information about the Libreoffice-commits mailing list