summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-11-23 21:42:47 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2016-11-23 20:42:34 +0000
commitf337e95fb50c9edc10aca859aaf08baab5294d2e (patch)
treebc50e0c1f6a22823f461659e54e9906134902e94 /vcl
parent4bb623d9bf545058e6bda2bbc54ef29459e43f2f (diff)
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@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/CommonSalLayout.hxx2
-rw-r--r--vcl/inc/unx/genpspgraphics.h2
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx7
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx61
4 files changed, 64 insertions, 8 deletions
diff --git a/vcl/inc/CommonSalLayout.hxx b/vcl/inc/CommonSalLayout.hxx
index 31b9dca73ecd..e5345d77a65b 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 170026777659..792e44f832bb 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 cf6a53a1ce24..ea7093d5dab9 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 8c73ec149140..455f186613a9 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -54,6 +54,7 @@
#include "PhysicalFontFace.hxx"
#include "salbmp.hxx"
#include "salprn.hxx"
+#include "CommonSalLayout.hxx"
#include <config_graphite.h>
#if ENABLE_GRAPHITE
@@ -692,9 +693,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 ];
@@ -764,6 +801,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] )
@@ -989,15 +1031,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 );