Fold CommonSalLayout into GenericSalLayout

Now the crazy constructors of CommonSalLayout are gone, we can merge
the two and drop one level of indirection.

Change-Id: I166e4ed2c9d22c1ce75246d486f7526c4928f652
Reviewed-on: https://gerrit.libreoffice.org/54077
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
This commit is contained in:
Khaled Hosny
2018-05-10 12:48:13 +02:00
parent e37135d413
commit a909afbc21
26 changed files with 119 additions and 165 deletions

View File

@@ -17547,7 +17547,6 @@ vcl/inc/BitmapProcessor.hxx
vcl/inc/BitmapScaleConvolutionFilter.hxx vcl/inc/BitmapScaleConvolutionFilter.hxx
vcl/inc/BitmapScaleSuperFilter.hxx vcl/inc/BitmapScaleSuperFilter.hxx
vcl/inc/BitmapSymmetryCheck.hxx vcl/inc/BitmapSymmetryCheck.hxx
vcl/inc/CommonSalLayout.hxx
vcl/inc/ControlCacheKey.hxx vcl/inc/ControlCacheKey.hxx
vcl/inc/PhysicalFontCollection.hxx vcl/inc/PhysicalFontCollection.hxx
vcl/inc/PhysicalFontFace.hxx vcl/inc/PhysicalFontFace.hxx

View File

@@ -19,7 +19,10 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_complextext, \
vcl/qa/cppunit/complextext \ vcl/qa/cppunit/complextext \
)) ))
$(eval $(call gb_CppunitTest_use_externals,vcl_complextext,boost_headers)) $(eval $(call gb_CppunitTest_use_externals,vcl_complextext,\
boost_headers \
harfbuzz \
))
ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),) ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
$(eval $(call gb_CppunitTest_use_package,vcl_complextext,fonts_dejavu)) $(eval $(call gb_CppunitTest_use_package,vcl_complextext,fonts_dejavu))

View File

@@ -18,6 +18,7 @@ $(eval $(call gb_Executable_use_api,vcldemo,\
$(eval $(call gb_Executable_use_externals,vcldemo,\ $(eval $(call gb_Executable_use_externals,vcldemo,\
boost_headers \ boost_headers \
glm_headers \ glm_headers \
harfbuzz \
)) ))
ifeq ($(ENABLE_HEADLESS),) ifeq ($(ENABLE_HEADLESS),)
$(eval $(call gb_Executable_use_externals,vcldemo,\ $(eval $(call gb_Executable_use_externals,vcldemo,\

View File

@@ -23,7 +23,7 @@
#include <headless/svpgdi.hxx> #include <headless/svpgdi.hxx>
#include <config_cairo_canvas.h> #include <config_cairo_canvas.h>
#include <impfontmetricdata.hxx> #include <impfontmetricdata.hxx>
#include <CommonSalLayout.hxx> #include <sallayout.hxx>
void SvpSalGraphics::SetFont( const FontSelectPattern* pIFSD, int nFallbackLevel ) void SvpSalGraphics::SetFont( const FontSelectPattern* pIFSD, int nFallbackLevel )
{ {
@@ -106,7 +106,7 @@ std::unique_ptr<SalLayout> SvpSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs,
return m_aTextRenderImpl.GetTextLayout(rArgs, nFallbackLevel); return m_aTextRenderImpl.GetTextLayout(rArgs, nFallbackLevel);
} }
void SvpSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) void SvpSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
{ {
m_aTextRenderImpl.DrawTextLayout(rLayout); m_aTextRenderImpl.DrawTextLayout(rLayout);
} }

View File

@@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX
#define INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include "sallayout.hxx"
#include "fontinstance.hxx"
#include <hb-icu.h>
class VCL_DLLPUBLIC CommonSalLayout : public GenericSalLayout
{
LogicalFontInstance* const mpFont;
css::uno::Reference<css::i18n::XBreakIterator> mxBreak;
void ParseFeatures(const OUString& name);
OString msLanguage;
std::vector<hb_feature_t> maFeatures;
hb_set_t* mpVertGlyphs;
const bool mbFuzzing;
bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar);
void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool);
public:
CommonSalLayout(LogicalFontInstance&);
~CommonSalLayout() override;
LogicalFontInstance& getFont() const { return *mpFont; }
virtual void InitFont() const override;
void AdjustLayout(ImplLayoutArgs&) final override;
bool LayoutText(ImplLayoutArgs&) final override;
void DrawText(SalGraphics&) const final override;
std::shared_ptr<vcl::TextLayoutCache> CreateTextLayoutCache(OUString const&) const final override;
bool GetCharWidths(DeviceCoordinate* pCharWidths) const final override;
void ApplyDXArray(ImplLayoutArgs&) final override;
bool IsKashidaPosValid(int nCharPos) const final override;
};
#endif // INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -171,7 +171,7 @@ public:
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual void DrawTextLayout( const GenericSalLayout& ) override;
virtual bool supportsOperation( OutDevSupportType ) const override; virtual bool supportsOperation( OutDevSupportType ) const override;
virtual void drawPixel( long nX, long nY ) override; virtual void drawPixel( long nX, long nY ) override;
virtual void drawPixel( long nX, long nY, Color nColor ) override; virtual void drawPixel( long nX, long nY, Color nColor ) override;

View File

@@ -53,7 +53,6 @@ class AquaSalFrame;
class FontAttributes; class FontAttributes;
class CoreTextStyle; class CoreTextStyle;
class XorEmulation; class XorEmulation;
class CommonSalLayout;
// CoreText-specific physically available font face // CoreText-specific physically available font face
class CoreTextFontFace : public PhysicalFontFace class CoreTextFontFace : public PhysicalFontFace
@@ -380,7 +379,7 @@ public:
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual void DrawTextLayout( const GenericSalLayout& ) override;
virtual bool supportsOperation( OutDevSupportType ) const override; virtual bool supportsOperation( OutDevSupportType ) const override;
#ifdef MACOSX #ifdef MACOSX

View File

@@ -44,7 +44,6 @@ class FontSubsetInfo;
class OpenGLContext; class OpenGLContext;
class OutputDevice; class OutputDevice;
class FreetypeFont; class FreetypeFont;
class CommonSalLayout;
struct SystemGraphicsData; struct SystemGraphicsData;
#if ENABLE_CAIRO_CANVAS #if ENABLE_CAIRO_CANVAS
@@ -194,7 +193,7 @@ public:
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
virtual void DrawTextLayout( const CommonSalLayout& ) = 0; virtual void DrawTextLayout( const GenericSalLayout& ) = 0;
virtual bool supportsOperation( OutDevSupportType ) const = 0; virtual bool supportsOperation( OutDevSupportType ) const = 0;

View File

@@ -25,6 +25,10 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <hb.h>
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx>
#include <i18nlangtag/languagetag.hxx> #include <i18nlangtag/languagetag.hxx>
#include <tools/gen.hxx> #include <tools/gen.hxx>
@@ -32,6 +36,8 @@
#include <vcl/vclenum.hxx> // for typedef sal_UCS4 #include <vcl/vclenum.hxx> // for typedef sal_UCS4
#include <vcl/devicecoordinate.hxx> #include <vcl/devicecoordinate.hxx>
#include "fontinstance.hxx"
#define MAX_FALLBACK 16 #define MAX_FALLBACK 16
@@ -304,12 +310,15 @@ public:
class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout
{ {
public: public:
// used by layout engines GenericSalLayout(LogicalFontInstance&);
void AppendGlyph( const GlyphItem& ); ~GenericSalLayout() override;
void Reserve(int size) { m_GlyphItems.reserve(size + 1); }
virtual void ApplyDXArray(ImplLayoutArgs&) = 0; void AdjustLayout(ImplLayoutArgs&) final override;
void Justify(DeviceCoordinate nNewWidth); bool LayoutText(ImplLayoutArgs&) final override;
void ApplyAsianKerning(const OUString& rStr); void DrawText(SalGraphics&) const final override;
std::shared_ptr<vcl::TextLayoutCache> CreateTextLayoutCache(OUString const&) const final override;
bool IsKashidaPosValid(int nCharPos) const final override;
// used by upper layers // used by upper layers
virtual DeviceCoordinate GetTextWidth() const override; virtual DeviceCoordinate GetTextWidth() const override;
@@ -318,25 +327,45 @@ public:
virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const override; virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const override;
// used by display layers // used by display layers
LogicalFontInstance& GetFont() const { return *mpFont; }
virtual bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int&, virtual bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int&,
const PhysicalFontFace** pFallbackFont = nullptr) const override; const PhysicalFontFace** pFallbackFont = nullptr) const override;
protected: protected:
GenericSalLayout();
virtual ~GenericSalLayout() override;
// for glyph+font+script fallback // for glyph+font+script fallback
virtual void MoveGlyph( int nStart, long nNewXPos ) override; void MoveGlyph(int nStart, long nNewXPos) final override;
virtual void DropGlyph( int nStart ) override; void DropGlyph(int nStart) final override;
virtual void Simplify( bool bIsBase ) override; void Simplify(bool bIsBase) final override;
virtual bool GetCharWidths(DeviceCoordinate* pCharWidths) const = 0;
std::vector<GlyphItem> m_GlyphItems;
private: private:
GenericSalLayout( const GenericSalLayout& ) = delete; GenericSalLayout( const GenericSalLayout& ) = delete;
GenericSalLayout& operator=( const GenericSalLayout& ) = delete; GenericSalLayout& operator=( const GenericSalLayout& ) = delete;
void AppendGlyph( const GlyphItem& );
void Reserve(int size) { m_GlyphItems.reserve(size + 1); }
void ApplyDXArray(ImplLayoutArgs&);
void Justify(DeviceCoordinate nNewWidth);
void ApplyAsianKerning(const OUString& rStr);
bool GetCharWidths(DeviceCoordinate* pCharWidths) const;
void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool);
bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar);
void ParseFeatures(const OUString& name);
LogicalFontInstance* const mpFont;
css::uno::Reference<css::i18n::XBreakIterator> mxBreak;
std::vector<GlyphItem> m_GlyphItems;
OString msLanguage;
std::vector<hb_feature_t> maFeatures;
hb_set_t* mpVertGlyphs;
const bool mbFuzzing;
}; };
#undef SalGraphics #undef SalGraphics

View File

@@ -63,7 +63,7 @@ public:
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0; virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0;
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
virtual void DrawTextLayout(const CommonSalLayout&) = 0; virtual void DrawTextLayout(const GenericSalLayout&) = 0;
#if ENABLE_CAIRO_CANVAS #if ENABLE_CAIRO_CANVAS
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const = 0; virtual SystemFontData GetSysFontData( int nFallbackLevel ) const = 0;
#endif // ENABLE_CAIRO_CANVAS #endif // ENABLE_CAIRO_CANVAS

View File

@@ -79,7 +79,7 @@ public:
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout(const CommonSalLayout&) override; virtual void DrawTextLayout(const GenericSalLayout&) override;
#if ENABLE_CAIRO_CANVAS #if ENABLE_CAIRO_CANVAS
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override; virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override;
#endif #endif

View File

@@ -115,7 +115,7 @@ public:
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual void DrawTextLayout( const GenericSalLayout& ) override;
virtual bool supportsOperation( OutDevSupportType ) const override; virtual bool supportsOperation( OutDevSupportType ) const override;
virtual void drawPixel( long nX, long nY ) override; virtual void drawPixel( long nX, long nY ) override;
virtual void drawPixel( long nX, long nY, Color nColor ) override; virtual void drawPixel( long nX, long nY, Color nColor ) override;

View File

@@ -145,7 +145,7 @@ public:
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual void DrawTextLayout( const GenericSalLayout& ) override;
virtual bool supportsOperation( OutDevSupportType ) const override; virtual bool supportsOperation( OutDevSupportType ) const override;
virtual void drawPixel( long nX, long nY ) override; virtual void drawPixel( long nX, long nY ) override;

View File

@@ -52,7 +52,7 @@ public:
explicit D2DWriteTextOutRenderer(); explicit D2DWriteTextOutRenderer();
virtual ~D2DWriteTextOutRenderer() override; virtual ~D2DWriteTextOutRenderer() override;
bool operator ()(CommonSalLayout const &rLayout, bool operator ()(GenericSalLayout const &rLayout,
SalGraphics &rGraphics, SalGraphics &rGraphics,
HDC hDC) override; HDC hDC) override;
@@ -81,7 +81,7 @@ private:
D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete;
bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const; bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const;
bool performRender(CommonSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool& bRetry); bool performRender(GenericSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool& bRetry);
ID2D1Factory * mpD2DFactory; ID2D1Factory * mpD2DFactory;
IDWriteFactory * mpDWriteFactory; IDWriteFactory * mpDWriteFactory;

View File

@@ -50,7 +50,6 @@ class PhysicalFontCollection;
class SalGraphicsImpl; class SalGraphicsImpl;
class WinOpenGLSalGraphicsImpl; class WinOpenGLSalGraphicsImpl;
class ImplFontMetricData; class ImplFontMetricData;
class CommonSalLayout;
#define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000) #define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000)
#define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) #define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff)
@@ -174,8 +173,8 @@ private:
LogicalFontInstance* GetWinFontEntry(int nFallbackLevel); LogicalFontInstance* GetWinFontEntry(int nFallbackLevel);
bool CacheGlyphs(const CommonSalLayout& rLayout); bool CacheGlyphs(const GenericSalLayout& rLayout);
bool DrawCachedGlyphs(const CommonSalLayout& rLayout); bool DrawCachedGlyphs(const GenericSalLayout& rLayout);
public: public:
HDC getHDC() const { return mhLocalDC; } HDC getHDC() const { return mhLocalDC; }
@@ -295,7 +294,7 @@ protected:
private: private:
// local helpers // local helpers
void DrawTextLayout(const CommonSalLayout&, HDC, bool bUseDWrite); void DrawTextLayout(const GenericSalLayout&, HDC, bool bUseDWrite);
public: public:
// public SalGraphics methods, the interface to the independent vcl part // public SalGraphics methods, the interface to the independent vcl part
@@ -378,7 +377,7 @@ public:
virtual std::unique_ptr<SalLayout> virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual void DrawTextLayout( const GenericSalLayout& ) override;
virtual bool supportsOperation( OutDevSupportType ) const override; virtual bool supportsOperation( OutDevSupportType ) const override;
// Query the platform layer for control support // Query the platform layer for control support

View File

@@ -25,7 +25,6 @@
#include <sallayout.hxx> #include <sallayout.hxx>
#include <svsys.h> #include <svsys.h>
#include <win/salgdi.h> #include <win/salgdi.h>
#include <CommonSalLayout.hxx>
#include <opengl/PackedTextureAtlas.hxx> #include <opengl/PackedTextureAtlas.hxx>
@@ -180,7 +179,7 @@ public:
virtual ~TextOutRenderer() = default; virtual ~TextOutRenderer() = default;
virtual bool operator ()(CommonSalLayout const &rLayout, virtual bool operator ()(GenericSalLayout const &rLayout,
SalGraphics &rGraphics, SalGraphics &rGraphics,
HDC hDC) = 0; HDC hDC) = 0;
}; };
@@ -193,7 +192,7 @@ class ExTextOutRenderer : public TextOutRenderer
public: public:
explicit ExTextOutRenderer() = default; explicit ExTextOutRenderer() = default;
bool operator ()(CommonSalLayout const &rLayout, bool operator ()(GenericSalLayout const &rLayout,
SalGraphics &rGraphics, SalGraphics &rGraphics,
HDC hDC) override; HDC hDC) override;
}; };

View File

@@ -184,7 +184,7 @@ public:
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout> GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) override; virtual std::unique_ptr<SalLayout> GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) override;
virtual void DrawTextLayout(const CommonSalLayout&) override; virtual void DrawTextLayout(const GenericSalLayout&) override;
// Native control support // Native control support

View File

@@ -23,7 +23,7 @@
#include <vcl/fontcharmap.hxx> #include <vcl/fontcharmap.hxx>
#include <CommonSalLayout.hxx> #include <sallayout.hxx>
#include <PhysicalFontCollection.hxx> #include <PhysicalFontCollection.hxx>
#include <QtGui/QFontDatabase> #include <QtGui/QFontDatabase>
@@ -142,10 +142,10 @@ bool Qt5Graphics::GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) {
std::unique_ptr<SalLayout> Qt5Graphics::GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) std::unique_ptr<SalLayout> Qt5Graphics::GetTextLayout(ImplLayoutArgs&, int nFallbackLevel)
{ {
if (m_pTextStyle[nFallbackLevel]) if (m_pTextStyle[nFallbackLevel])
return std::unique_ptr<SalLayout>(new CommonSalLayout(*m_pTextStyle[nFallbackLevel])); return std::unique_ptr<SalLayout>(new GenericSalLayout(*m_pTextStyle[nFallbackLevel]));
return std::unique_ptr<SalLayout>(); return std::unique_ptr<SalLayout>();
} }
void Qt5Graphics::DrawTextLayout(const CommonSalLayout&) {} void Qt5Graphics::DrawTextLayout(const GenericSalLayout&) {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -40,7 +40,6 @@
#include <impfont.hxx> #include <impfont.hxx>
#include <impfontcharmap.hxx> #include <impfontcharmap.hxx>
#include <impfontmetricdata.hxx> #include <impfontmetricdata.hxx>
#include <CommonSalLayout.hxx>
#include <outdev.h> #include <outdev.h>
#include <PhysicalFontCollection.hxx> #include <PhysicalFontCollection.hxx>
@@ -407,9 +406,9 @@ bool AquaSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangl
return false; return false;
} }
void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
{ {
const CoreTextStyle& rStyle = *static_cast<const CoreTextStyle*>(&rLayout.getFont()); const CoreTextStyle& rStyle = *static_cast<const CoreTextStyle*>(&rLayout.GetFont());
const FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); const FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern();
if (rFontSelect.mnHeight == 0) if (rFontSelect.mnHeight == 0)
return; return;
@@ -521,7 +520,7 @@ void AquaSalGraphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLe
std::unique_ptr<SalLayout> AquaSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) std::unique_ptr<SalLayout> AquaSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel)
{ {
if (mpTextStyle[nFallbackLevel]) if (mpTextStyle[nFallbackLevel])
return std::unique_ptr<SalLayout>(new CommonSalLayout(*mpTextStyle[nFallbackLevel])); return std::unique_ptr<SalLayout>(new GenericSalLayout(*mpTextStyle[nFallbackLevel]));
return nullptr; return nullptr;
} }

View File

@@ -18,7 +18,10 @@
*/ */
#include <memory> #include <memory>
#include <CommonSalLayout.hxx>
#include <hb-icu.h>
#include <sallayout.hxx>
#include <unotools/configmgr.hxx> #include <unotools/configmgr.hxx>
#include <vcl/unohelp.hxx> #include <vcl/unohelp.hxx>
@@ -50,7 +53,7 @@ static hb_unicode_funcs_t* getUnicodeFuncs()
} }
#endif #endif
CommonSalLayout::CommonSalLayout(LogicalFontInstance &rFont) GenericSalLayout::GenericSalLayout(LogicalFontInstance &rFont)
: mpFont(&rFont) : mpFont(&rFont)
, mpVertGlyphs(nullptr) , mpVertGlyphs(nullptr)
, mbFuzzing(utl::ConfigManager::IsFuzzing()) , mbFuzzing(utl::ConfigManager::IsFuzzing())
@@ -58,12 +61,12 @@ CommonSalLayout::CommonSalLayout(LogicalFontInstance &rFont)
mpFont->Acquire(); mpFont->Acquire();
} }
CommonSalLayout::~CommonSalLayout() GenericSalLayout::~GenericSalLayout()
{ {
mpFont->Release(); mpFont->Release();
} }
void CommonSalLayout::ParseFeatures(const OUString& aName) void GenericSalLayout::ParseFeatures(const OUString& aName)
{ {
if (aName.indexOf(FontSelectPatternAttributes::FEAT_PREFIX) < 0) if (aName.indexOf(FontSelectPatternAttributes::FEAT_PREFIX) < 0)
return; return;
@@ -88,10 +91,6 @@ void CommonSalLayout::ParseFeatures(const OUString& aName)
while (nIndex >= 0); while (nIndex >= 0);
} }
void CommonSalLayout::InitFont() const
{
}
struct SubRun struct SubRun
{ {
int32_t mnMin; int32_t mnMin;
@@ -175,12 +174,12 @@ namespace {
} // namespace } // namespace
std::shared_ptr<vcl::TextLayoutCache> CommonSalLayout::CreateTextLayoutCache(OUString const& rString) const std::shared_ptr<vcl::TextLayoutCache> GenericSalLayout::CreateTextLayoutCache(OUString const& rString) const
{ {
return std::make_shared<vcl::TextLayoutCache>(rString.getStr(), rString.getLength()); return std::make_shared<vcl::TextLayoutCache>(rString.getStr(), rString.getLength());
} }
void CommonSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos, bool bRightToLeft) void GenericSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos, bool bRightToLeft)
{ {
if (nCharPos < 0 || mbFuzzing) if (nCharPos < 0 || mbFuzzing)
return; return;
@@ -206,7 +205,7 @@ void CommonSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos,
rArgs.NeedFallback(nGraphemeStartPos, nGraphemeEndPos, bRightToLeft); rArgs.NeedFallback(nGraphemeStartPos, nGraphemeEndPos, bRightToLeft);
} }
void CommonSalLayout::AdjustLayout(ImplLayoutArgs& rArgs) void GenericSalLayout::AdjustLayout(ImplLayoutArgs& rArgs)
{ {
SalLayout::AdjustLayout(rArgs); SalLayout::AdjustLayout(rArgs);
@@ -222,7 +221,7 @@ void CommonSalLayout::AdjustLayout(ImplLayoutArgs& rArgs)
ApplyAsianKerning(rArgs.mrStr); ApplyAsianKerning(rArgs.mrStr);
} }
void CommonSalLayout::DrawText(SalGraphics& rSalGraphics) const void GenericSalLayout::DrawText(SalGraphics& rSalGraphics) const
{ {
//call platform dependent DrawText functions //call platform dependent DrawText functions
rSalGraphics.DrawTextLayout( *this ); rSalGraphics.DrawTextLayout( *this );
@@ -232,7 +231,7 @@ void CommonSalLayout::DrawText(SalGraphics& rSalGraphics) const
// We dont check for a specific script or language as it shouldnt matter // We dont check for a specific script or language as it shouldnt matter
// here; if the glyph would be the result from applying “vert” for any // here; if the glyph would be the result from applying “vert” for any
// script/language then we want to always treat it as upright glyph. // script/language then we want to always treat it as upright glyph.
bool CommonSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSelector) bool GenericSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSelector)
{ {
hb_codepoint_t nGlyphIndex = 0; hb_codepoint_t nGlyphIndex = 0;
hb_font_t *pHbFont = mpFont->GetHbFont(); hb_font_t *pHbFont = mpFont->GetHbFont();
@@ -269,7 +268,7 @@ bool CommonSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSe
return hb_set_has(mpVertGlyphs, nGlyphIndex) != 0; return hb_set_has(mpVertGlyphs, nGlyphIndex) != 0;
} }
bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs)
{ {
hb_font_t *pHbFont = mpFont->GetHbFont(); hb_font_t *pHbFont = mpFont->GetHbFont();
hb_face_t* pHbFace = hb_font_get_face(pHbFont); hb_face_t* pHbFace = hb_font_get_face(pHbFont);
@@ -584,7 +583,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
return true; return true;
} }
bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const bool GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
{ {
int nCharCount = mnEndCharPos - mnMinCharPos; int nCharCount = mnEndCharPos - mnMinCharPos;
@@ -614,7 +613,7 @@ bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
// * For any RTL glyph that has DX adjustment, insert enough Kashidas to // * For any RTL glyph that has DX adjustment, insert enough Kashidas to
// fill in the added space. // fill in the added space.
void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs) void GenericSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
{ {
if (rArgs.mpDXArray == nullptr) if (rArgs.mpDXArray == nullptr)
return; return;
@@ -780,7 +779,7 @@ void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
} }
} }
bool CommonSalLayout::IsKashidaPosValid(int nCharPos) const bool GenericSalLayout::IsKashidaPosValid(int nCharPos) const
{ {
for (auto pIter = m_GlyphItems.begin(); pIter != m_GlyphItems.end(); ++pIter) for (auto pIter = m_GlyphItems.begin(); pIter != m_GlyphItems.end(); ++pIter)
{ {

View File

@@ -691,12 +691,6 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, tools::Rectangle& rRect
return bRet; return bRet;
} }
GenericSalLayout::GenericSalLayout()
{}
GenericSalLayout::~GenericSalLayout()
{}
void GenericSalLayout::AppendGlyph( const GlyphItem& rGlyphItem ) void GenericSalLayout::AppendGlyph( const GlyphItem& rGlyphItem )
{ {
m_GlyphItems.push_back(rGlyphItem); m_GlyphItems.push_back(rGlyphItem);

View File

@@ -38,7 +38,7 @@
#include <cairo.h> #include <cairo.h>
#include <cairo-ft.h> #include <cairo-ft.h>
#include <CommonSalLayout.hxx> #include <sallayout.hxx>
namespace { namespace {
@@ -168,9 +168,9 @@ namespace
} }
} }
void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout) void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout)
{ {
const FreetypeFontInstance& rInstance = static_cast<FreetypeFontInstance&>(rLayout.getFont()); const FreetypeFontInstance& rInstance = static_cast<FreetypeFontInstance&>(rLayout.GetFont());
const FreetypeFont& rFont = *rInstance.GetFreetypeFont(); const FreetypeFont& rFont = *rInstance.GetFreetypeFont();
std::vector<cairo_glyph_t> cairo_glyphs; std::vector<cairo_glyph_t> cairo_glyphs;
@@ -472,7 +472,7 @@ bool CairoTextRender::GetGlyphOutline(const GlyphItem& rGlyph,
std::unique_ptr<SalLayout> CairoTextRender::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) std::unique_ptr<SalLayout> CairoTextRender::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel)
{ {
if (mpFreetypeFont[nFallbackLevel]) if (mpFreetypeFont[nFallbackLevel])
return std::unique_ptr<SalLayout>(new CommonSalLayout(*mpFreetypeFont[nFallbackLevel]->GetFontInstance())); return std::unique_ptr<SalLayout>(new GenericSalLayout(*mpFreetypeFont[nFallbackLevel]->GetFontInstance()));
return nullptr; return nullptr;
} }

View File

@@ -24,7 +24,7 @@
#include <unx/salgdi.h> #include <unx/salgdi.h>
#include <unx/salvd.h> #include <unx/salvd.h>
#include <textrender.hxx> #include <textrender.hxx>
#include <CommonSalLayout.hxx> #include <sallayout.hxx>
GC GC
X11SalGraphics::GetFontGC() X11SalGraphics::GetFontGC()
@@ -53,7 +53,7 @@ X11SalGraphics::GetFontGC()
return pFontGC_; return pFontGC_;
} }
void X11SalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) void X11SalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
{ {
mxTextRenderImpl->DrawTextLayout(rLayout); mxTextRenderImpl->DrawTextLayout(rLayout);
} }

View File

@@ -54,7 +54,7 @@
#include <PhysicalFontFace.hxx> #include <PhysicalFontFace.hxx>
#include <salbmp.hxx> #include <salbmp.hxx>
#include <salprn.hxx> #include <salprn.hxx>
#include <CommonSalLayout.hxx> #include <sallayout.hxx>
using namespace psp; using namespace psp;
@@ -529,12 +529,12 @@ ImplPspFontData::ImplPspFontData(const psp::FastPrintFontInfo& rInfo)
mnFontId( rInfo.m_nID ) mnFontId( rInfo.m_nID )
{} {}
class PspCommonSalLayout : public CommonSalLayout class PspSalLayout : public GenericSalLayout
{ {
public: public:
PspCommonSalLayout(psp::PrinterGfx&, FreetypeFont& rFont); PspSalLayout(psp::PrinterGfx&, FreetypeFont& rFont);
virtual void InitFont() const override; void InitFont() const final override;
private: private:
::psp::PrinterGfx& mrPrinterGfx; ::psp::PrinterGfx& mrPrinterGfx;
@@ -546,8 +546,8 @@ private:
bool mbArtBold; bool mbArtBold;
}; };
PspCommonSalLayout::PspCommonSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rFont) PspSalLayout::PspSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rFont)
: CommonSalLayout(*rFont.GetFontInstance()) : GenericSalLayout(*rFont.GetFontInstance())
, mrPrinterGfx(rGfx) , mrPrinterGfx(rGfx)
{ {
mnFontID = mrPrinterGfx.GetFontID(); mnFontID = mrPrinterGfx.GetFontID();
@@ -558,14 +558,14 @@ PspCommonSalLayout::PspCommonSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rF
mbArtBold = mrPrinterGfx.GetArtificialBold(); mbArtBold = mrPrinterGfx.GetArtificialBold();
} }
void PspCommonSalLayout::InitFont() const void PspSalLayout::InitFont() const
{ {
CommonSalLayout::InitFont(); GenericSalLayout::InitFont();
mrPrinterGfx.SetFont(mnFontID, mnFontHeight, mnFontWidth, mrPrinterGfx.SetFont(mnFontID, mnFontHeight, mnFontWidth,
mnOrientation, mbVertical, mbArtItalic, mbArtBold); mnOrientation, mbVertical, mbArtItalic, mbArtBold);
} }
void GenPspGraphics::DrawTextLayout(const CommonSalLayout& rLayout) void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
{ {
const GlyphItem* pGlyph; const GlyphItem* pGlyph;
Point aPos; Point aPos;
@@ -763,7 +763,7 @@ bool GenPspGraphics::GetGlyphOutline(const GlyphItem& rGlyph,
std::unique_ptr<SalLayout> GenPspGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel) std::unique_ptr<SalLayout> GenPspGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel)
{ {
if (m_pFreetypeFont[nFallbackLevel]) if (m_pFreetypeFont[nFallbackLevel])
return std::unique_ptr<SalLayout>(new PspCommonSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel])); return std::unique_ptr<SalLayout>(new PspSalLayout(*m_pPrinterGfx, *m_pFreetypeFont[nFallbackLevel]));
return nullptr; return nullptr;
} }

View File

@@ -25,7 +25,6 @@
#include <sft.hxx> #include <sft.hxx>
#include <sallayout.hxx> #include <sallayout.hxx>
#include <CommonSalLayout.hxx>
#include <shlwapi.h> #include <shlwapi.h>
#include <winver.h> #include <winver.h>
@@ -233,7 +232,7 @@ HRESULT D2DWriteTextOutRenderer::BindDC(HDC hDC, tools::Rectangle const & rRect)
return CHECKHR(mpRT->BindDC(hDC, &rc)); return CHECKHR(mpRT->BindDC(hDC, &rc));
} }
bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC) bool D2DWriteTextOutRenderer::operator ()(GenericSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC)
{ {
bool bRetry = false; bool bRetry = false;
bool bResult = false; bool bResult = false;
@@ -247,7 +246,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const & rLayout, SalGr
return bResult; return bResult;
} }
bool D2DWriteTextOutRenderer::performRender(CommonSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC, bool& bRetry) bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, SalGraphics& rGraphics, HDC hDC, bool& bRetry)
{ {
if (!Ready()) if (!Ready())
return false; return false;

View File

@@ -35,7 +35,6 @@
#include <sft.hxx> #include <sft.hxx>
#include <sallayout.hxx> #include <sallayout.hxx>
#include <CommonSalLayout.hxx>
#include <win/ScopedHDC.hxx> #include <win/ScopedHDC.hxx>
#include <cstdio> #include <cstdio>
@@ -226,7 +225,7 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
} }
bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout, bool ExTextOutRenderer::operator ()(GenericSalLayout const &rLayout,
SalGraphics & /*rGraphics*/, SalGraphics & /*rGraphics*/,
HDC hDC) HDC hDC)
{ {
@@ -234,7 +233,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
HFONT hAltFont = nullptr; HFONT hAltFont = nullptr;
bool bUseAltFont = false; bool bUseAltFont = false;
bool bShift = false; bool bShift = false;
if (rLayout.getFont().GetFontSelectPattern().mbVertical) if (rLayout.GetFont().GetFontSelectPattern().mbVertical)
{ {
LOGFONTW aLogFont; LOGFONTW aLogFont;
GetObjectW(hFont, sizeof(aLogFont), &aLogFont); GetObjectW(hFont, sizeof(aLogFont), &aLogFont);
@@ -291,7 +290,7 @@ std::unique_ptr<SalLayout> WinSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs
assert(mpWinFontEntry[nFallbackLevel]->GetFontFace()); assert(mpWinFontEntry[nFallbackLevel]->GetFontFace());
mpWinFontEntry[nFallbackLevel]->SetHDC(getHDC()); mpWinFontEntry[nFallbackLevel]->SetHDC(getHDC());
CommonSalLayout *aLayout = new CommonSalLayout(*mpWinFontEntry[nFallbackLevel]); GenericSalLayout *aLayout = new GenericSalLayout(*mpWinFontEntry[nFallbackLevel]);
return std::unique_ptr<SalLayout>(aLayout); return std::unique_ptr<SalLayout>(aLayout);
} }
@@ -381,14 +380,14 @@ void WinFontInstance::SetHDC(const HDC hDC)
m_hDC = hDC; m_hDC = hDC;
} }
bool WinSalGraphics::CacheGlyphs(const CommonSalLayout& rLayout) bool WinSalGraphics::CacheGlyphs(const GenericSalLayout& rLayout)
{ {
static bool bDoGlyphCaching = (std::getenv("SAL_DISABLE_GLYPH_CACHING") == nullptr); static bool bDoGlyphCaching = (std::getenv("SAL_DISABLE_GLYPH_CACHING") == nullptr);
if (!bDoGlyphCaching) if (!bDoGlyphCaching)
return false; return false;
HDC hDC = getHDC(); HDC hDC = getHDC();
WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.getFont()); WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.GetFont());
int nStart = 0; int nStart = 0;
Point aPos(0, 0); Point aPos(0, 0);
@@ -405,7 +404,7 @@ bool WinSalGraphics::CacheGlyphs(const CommonSalLayout& rLayout)
return true; return true;
} }
bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout) bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout)
{ {
HDC hDC = getHDC(); HDC hDC = getHDC();
@@ -419,7 +418,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout)
if (!pImpl) if (!pImpl)
return false; return false;
WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.getFont()); WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.GetFont());
int nStart = 0; int nStart = 0;
Point aPos(0, 0); Point aPos(0, 0);
@@ -444,22 +443,22 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout)
return true; return true;
} }
void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC, bool bUseDWrite) void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout, HDC hDC, bool bUseDWrite)
{ {
TextOutRenderer &render = TextOutRenderer::get(bUseDWrite); TextOutRenderer &render = TextOutRenderer::get(bUseDWrite);
render(rLayout, *this, hDC); render(rLayout, *this, hDC);
} }
void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
{ {
HDC hDC = getHDC(); HDC hDC = getHDC();
HFONT hFont = static_cast<const WinFontInstance*>(&rLayout.getFont())->GetHFONT(); HFONT hFont = static_cast<const WinFontInstance*>(&rLayout.GetFont())->GetHFONT();
HGDIOBJ hOrigFont = SelectObject(hDC, hFont); HGDIOBJ hOrigFont = SelectObject(hDC, hFont);
// Our DirectWrite renderer is incomplete, skip it for non-horizontal or // Our DirectWrite renderer is incomplete, skip it for non-horizontal or
// stretched text. // stretched text.
bool bForceGDI = rLayout.GetOrientation() || static_cast<const WinFontInstance*>(&rLayout.getFont())->hasHScale(); bool bForceGDI = rLayout.GetOrientation() || static_cast<const WinFontInstance*>(&rLayout.GetFont())->hasHScale();
bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter; bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter;
if (!bUseOpenGL) if (!bUseOpenGL)