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:
@@ -17547,7 +17547,6 @@ vcl/inc/BitmapProcessor.hxx
|
||||
vcl/inc/BitmapScaleConvolutionFilter.hxx
|
||||
vcl/inc/BitmapScaleSuperFilter.hxx
|
||||
vcl/inc/BitmapSymmetryCheck.hxx
|
||||
vcl/inc/CommonSalLayout.hxx
|
||||
vcl/inc/ControlCacheKey.hxx
|
||||
vcl/inc/PhysicalFontCollection.hxx
|
||||
vcl/inc/PhysicalFontFace.hxx
|
||||
|
@@ -19,7 +19,10 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_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)),)
|
||||
$(eval $(call gb_CppunitTest_use_package,vcl_complextext,fonts_dejavu))
|
||||
|
@@ -18,6 +18,7 @@ $(eval $(call gb_Executable_use_api,vcldemo,\
|
||||
$(eval $(call gb_Executable_use_externals,vcldemo,\
|
||||
boost_headers \
|
||||
glm_headers \
|
||||
harfbuzz \
|
||||
))
|
||||
ifeq ($(ENABLE_HEADLESS),)
|
||||
$(eval $(call gb_Executable_use_externals,vcldemo,\
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include <headless/svpgdi.hxx>
|
||||
#include <config_cairo_canvas.h>
|
||||
#include <impfontmetricdata.hxx>
|
||||
#include <CommonSalLayout.hxx>
|
||||
#include <sallayout.hxx>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void SvpSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
|
||||
void SvpSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
|
||||
{
|
||||
m_aTextRenderImpl.DrawTextLayout(rLayout);
|
||||
}
|
||||
|
@@ -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: */
|
@@ -171,7 +171,7 @@ public:
|
||||
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawTextLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawTextLayout( const GenericSalLayout& ) override;
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
virtual void drawPixel( long nX, long nY ) override;
|
||||
virtual void drawPixel( long nX, long nY, Color nColor ) override;
|
||||
|
@@ -53,7 +53,6 @@ class AquaSalFrame;
|
||||
class FontAttributes;
|
||||
class CoreTextStyle;
|
||||
class XorEmulation;
|
||||
class CommonSalLayout;
|
||||
|
||||
// CoreText-specific physically available font face
|
||||
class CoreTextFontFace : public PhysicalFontFace
|
||||
@@ -380,7 +379,7 @@ public:
|
||||
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawTextLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawTextLayout( const GenericSalLayout& ) override;
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
|
||||
#ifdef MACOSX
|
||||
|
@@ -44,7 +44,6 @@ class FontSubsetInfo;
|
||||
class OpenGLContext;
|
||||
class OutputDevice;
|
||||
class FreetypeFont;
|
||||
class CommonSalLayout;
|
||||
struct SystemGraphicsData;
|
||||
|
||||
#if ENABLE_CAIRO_CANVAS
|
||||
@@ -194,7 +193,7 @@ public:
|
||||
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
|
||||
virtual void DrawTextLayout( const CommonSalLayout& ) = 0;
|
||||
virtual void DrawTextLayout( const GenericSalLayout& ) = 0;
|
||||
|
||||
virtual bool supportsOperation( OutDevSupportType ) const = 0;
|
||||
|
||||
|
@@ -25,6 +25,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <hb.h>
|
||||
|
||||
#include <com/sun/star/i18n/XBreakIterator.hpp>
|
||||
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
#include <i18nlangtag/languagetag.hxx>
|
||||
#include <tools/gen.hxx>
|
||||
@@ -32,6 +36,8 @@
|
||||
#include <vcl/vclenum.hxx> // for typedef sal_UCS4
|
||||
#include <vcl/devicecoordinate.hxx>
|
||||
|
||||
#include "fontinstance.hxx"
|
||||
|
||||
#define MAX_FALLBACK 16
|
||||
|
||||
|
||||
@@ -304,12 +310,15 @@ public:
|
||||
class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout
|
||||
{
|
||||
public:
|
||||
// used by layout engines
|
||||
void AppendGlyph( const GlyphItem& );
|
||||
void Reserve(int size) { m_GlyphItems.reserve(size + 1); }
|
||||
virtual void ApplyDXArray(ImplLayoutArgs&) = 0;
|
||||
void Justify(DeviceCoordinate nNewWidth);
|
||||
void ApplyAsianKerning(const OUString& rStr);
|
||||
GenericSalLayout(LogicalFontInstance&);
|
||||
~GenericSalLayout() 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 IsKashidaPosValid(int nCharPos) const final override;
|
||||
|
||||
// used by upper layers
|
||||
virtual DeviceCoordinate GetTextWidth() const override;
|
||||
@@ -318,25 +327,45 @@ public:
|
||||
virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const override;
|
||||
|
||||
// used by display layers
|
||||
LogicalFontInstance& GetFont() const { return *mpFont; }
|
||||
|
||||
virtual bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int&,
|
||||
const PhysicalFontFace** pFallbackFont = nullptr) const override;
|
||||
|
||||
protected:
|
||||
GenericSalLayout();
|
||||
virtual ~GenericSalLayout() override;
|
||||
|
||||
// for glyph+font+script fallback
|
||||
virtual void MoveGlyph( int nStart, long nNewXPos ) override;
|
||||
virtual void DropGlyph( int nStart ) override;
|
||||
virtual void Simplify( bool bIsBase ) override;
|
||||
|
||||
virtual bool GetCharWidths(DeviceCoordinate* pCharWidths) const = 0;
|
||||
|
||||
std::vector<GlyphItem> m_GlyphItems;
|
||||
void MoveGlyph(int nStart, long nNewXPos) final override;
|
||||
void DropGlyph(int nStart) final override;
|
||||
void Simplify(bool bIsBase) final override;
|
||||
|
||||
private:
|
||||
GenericSalLayout( 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
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0;
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
|
||||
virtual void DrawTextLayout(const CommonSalLayout&) = 0;
|
||||
virtual void DrawTextLayout(const GenericSalLayout&) = 0;
|
||||
#if ENABLE_CAIRO_CANVAS
|
||||
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const = 0;
|
||||
#endif // ENABLE_CAIRO_CANVAS
|
||||
|
@@ -79,7 +79,7 @@ public:
|
||||
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawTextLayout(const CommonSalLayout&) override;
|
||||
virtual void DrawTextLayout(const GenericSalLayout&) override;
|
||||
#if ENABLE_CAIRO_CANVAS
|
||||
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override;
|
||||
#endif
|
||||
|
@@ -115,7 +115,7 @@ public:
|
||||
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawTextLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawTextLayout( const GenericSalLayout& ) override;
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
virtual void drawPixel( long nX, long nY ) override;
|
||||
virtual void drawPixel( long nX, long nY, Color nColor ) override;
|
||||
|
@@ -145,7 +145,7 @@ public:
|
||||
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawTextLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawTextLayout( const GenericSalLayout& ) override;
|
||||
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
virtual void drawPixel( long nX, long nY ) override;
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
explicit D2DWriteTextOutRenderer();
|
||||
virtual ~D2DWriteTextOutRenderer() override;
|
||||
|
||||
bool operator ()(CommonSalLayout const &rLayout,
|
||||
bool operator ()(GenericSalLayout const &rLayout,
|
||||
SalGraphics &rGraphics,
|
||||
HDC hDC) override;
|
||||
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete;
|
||||
|
||||
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;
|
||||
IDWriteFactory * mpDWriteFactory;
|
||||
|
@@ -50,7 +50,6 @@ class PhysicalFontCollection;
|
||||
class SalGraphicsImpl;
|
||||
class WinOpenGLSalGraphicsImpl;
|
||||
class ImplFontMetricData;
|
||||
class CommonSalLayout;
|
||||
|
||||
#define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000)
|
||||
#define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff)
|
||||
@@ -174,8 +173,8 @@ private:
|
||||
|
||||
LogicalFontInstance* GetWinFontEntry(int nFallbackLevel);
|
||||
|
||||
bool CacheGlyphs(const CommonSalLayout& rLayout);
|
||||
bool DrawCachedGlyphs(const CommonSalLayout& rLayout);
|
||||
bool CacheGlyphs(const GenericSalLayout& rLayout);
|
||||
bool DrawCachedGlyphs(const GenericSalLayout& rLayout);
|
||||
|
||||
public:
|
||||
HDC getHDC() const { return mhLocalDC; }
|
||||
@@ -295,7 +294,7 @@ protected:
|
||||
private:
|
||||
// local helpers
|
||||
|
||||
void DrawTextLayout(const CommonSalLayout&, HDC, bool bUseDWrite);
|
||||
void DrawTextLayout(const GenericSalLayout&, HDC, bool bUseDWrite);
|
||||
|
||||
public:
|
||||
// public SalGraphics methods, the interface to the independent vcl part
|
||||
@@ -378,7 +377,7 @@ public:
|
||||
|
||||
virtual std::unique_ptr<SalLayout>
|
||||
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
|
||||
virtual void DrawTextLayout( const CommonSalLayout& ) override;
|
||||
virtual void DrawTextLayout( const GenericSalLayout& ) override;
|
||||
|
||||
virtual bool supportsOperation( OutDevSupportType ) const override;
|
||||
// Query the platform layer for control support
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <sallayout.hxx>
|
||||
#include <svsys.h>
|
||||
#include <win/salgdi.h>
|
||||
#include <CommonSalLayout.hxx>
|
||||
|
||||
#include <opengl/PackedTextureAtlas.hxx>
|
||||
|
||||
@@ -180,7 +179,7 @@ public:
|
||||
|
||||
virtual ~TextOutRenderer() = default;
|
||||
|
||||
virtual bool operator ()(CommonSalLayout const &rLayout,
|
||||
virtual bool operator ()(GenericSalLayout const &rLayout,
|
||||
SalGraphics &rGraphics,
|
||||
HDC hDC) = 0;
|
||||
};
|
||||
@@ -193,7 +192,7 @@ class ExTextOutRenderer : public TextOutRenderer
|
||||
public:
|
||||
explicit ExTextOutRenderer() = default;
|
||||
|
||||
bool operator ()(CommonSalLayout const &rLayout,
|
||||
bool operator ()(GenericSalLayout const &rLayout,
|
||||
SalGraphics &rGraphics,
|
||||
HDC hDC) override;
|
||||
};
|
||||
|
@@ -184,7 +184,7 @@ public:
|
||||
virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) 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
|
||||
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <vcl/fontcharmap.hxx>
|
||||
|
||||
#include <CommonSalLayout.hxx>
|
||||
#include <sallayout.hxx>
|
||||
#include <PhysicalFontCollection.hxx>
|
||||
|
||||
#include <QtGui/QFontDatabase>
|
||||
@@ -142,10 +142,10 @@ bool Qt5Graphics::GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) {
|
||||
std::unique_ptr<SalLayout> Qt5Graphics::GetTextLayout(ImplLayoutArgs&, int 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>();
|
||||
}
|
||||
|
||||
void Qt5Graphics::DrawTextLayout(const CommonSalLayout&) {}
|
||||
void Qt5Graphics::DrawTextLayout(const GenericSalLayout&) {}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -40,7 +40,6 @@
|
||||
#include <impfont.hxx>
|
||||
#include <impfontcharmap.hxx>
|
||||
#include <impfontmetricdata.hxx>
|
||||
#include <CommonSalLayout.hxx>
|
||||
#include <outdev.h>
|
||||
#include <PhysicalFontCollection.hxx>
|
||||
|
||||
@@ -407,9 +406,9 @@ bool AquaSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangl
|
||||
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();
|
||||
if (rFontSelect.mnHeight == 0)
|
||||
return;
|
||||
@@ -521,7 +520,7 @@ void AquaSalGraphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLe
|
||||
std::unique_ptr<SalLayout> AquaSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int nFallbackLevel)
|
||||
{
|
||||
if (mpTextStyle[nFallbackLevel])
|
||||
return std::unique_ptr<SalLayout>(new CommonSalLayout(*mpTextStyle[nFallbackLevel]));
|
||||
return std::unique_ptr<SalLayout>(new GenericSalLayout(*mpTextStyle[nFallbackLevel]));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -18,7 +18,10 @@
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <CommonSalLayout.hxx>
|
||||
|
||||
#include <hb-icu.h>
|
||||
|
||||
#include <sallayout.hxx>
|
||||
|
||||
#include <unotools/configmgr.hxx>
|
||||
#include <vcl/unohelp.hxx>
|
||||
@@ -50,7 +53,7 @@ static hb_unicode_funcs_t* getUnicodeFuncs()
|
||||
}
|
||||
#endif
|
||||
|
||||
CommonSalLayout::CommonSalLayout(LogicalFontInstance &rFont)
|
||||
GenericSalLayout::GenericSalLayout(LogicalFontInstance &rFont)
|
||||
: mpFont(&rFont)
|
||||
, mpVertGlyphs(nullptr)
|
||||
, mbFuzzing(utl::ConfigManager::IsFuzzing())
|
||||
@@ -58,12 +61,12 @@ CommonSalLayout::CommonSalLayout(LogicalFontInstance &rFont)
|
||||
mpFont->Acquire();
|
||||
}
|
||||
|
||||
CommonSalLayout::~CommonSalLayout()
|
||||
GenericSalLayout::~GenericSalLayout()
|
||||
{
|
||||
mpFont->Release();
|
||||
}
|
||||
|
||||
void CommonSalLayout::ParseFeatures(const OUString& aName)
|
||||
void GenericSalLayout::ParseFeatures(const OUString& aName)
|
||||
{
|
||||
if (aName.indexOf(FontSelectPatternAttributes::FEAT_PREFIX) < 0)
|
||||
return;
|
||||
@@ -88,10 +91,6 @@ void CommonSalLayout::ParseFeatures(const OUString& aName)
|
||||
while (nIndex >= 0);
|
||||
}
|
||||
|
||||
void CommonSalLayout::InitFont() const
|
||||
{
|
||||
}
|
||||
|
||||
struct SubRun
|
||||
{
|
||||
int32_t mnMin;
|
||||
@@ -175,12 +174,12 @@ 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());
|
||||
}
|
||||
|
||||
void CommonSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos, bool bRightToLeft)
|
||||
void GenericSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos, bool bRightToLeft)
|
||||
{
|
||||
if (nCharPos < 0 || mbFuzzing)
|
||||
return;
|
||||
@@ -206,7 +205,7 @@ void CommonSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos,
|
||||
rArgs.NeedFallback(nGraphemeStartPos, nGraphemeEndPos, bRightToLeft);
|
||||
}
|
||||
|
||||
void CommonSalLayout::AdjustLayout(ImplLayoutArgs& rArgs)
|
||||
void GenericSalLayout::AdjustLayout(ImplLayoutArgs& rArgs)
|
||||
{
|
||||
SalLayout::AdjustLayout(rArgs);
|
||||
|
||||
@@ -222,7 +221,7 @@ void CommonSalLayout::AdjustLayout(ImplLayoutArgs& rArgs)
|
||||
ApplyAsianKerning(rArgs.mrStr);
|
||||
}
|
||||
|
||||
void CommonSalLayout::DrawText(SalGraphics& rSalGraphics) const
|
||||
void GenericSalLayout::DrawText(SalGraphics& rSalGraphics) const
|
||||
{
|
||||
//call platform dependent DrawText functions
|
||||
rSalGraphics.DrawTextLayout( *this );
|
||||
@@ -232,7 +231,7 @@ void CommonSalLayout::DrawText(SalGraphics& rSalGraphics) const
|
||||
// We don’t check for a specific script or language as it shouldn’t matter
|
||||
// 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.
|
||||
bool CommonSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSelector)
|
||||
bool GenericSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSelector)
|
||||
{
|
||||
hb_codepoint_t nGlyphIndex = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
|
||||
bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs)
|
||||
{
|
||||
hb_font_t *pHbFont = mpFont->GetHbFont();
|
||||
hb_face_t* pHbFace = hb_font_get_face(pHbFont);
|
||||
@@ -584,7 +583,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
|
||||
bool GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
|
||||
{
|
||||
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
|
||||
// fill in the added space.
|
||||
|
||||
void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
|
||||
void GenericSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
|
||||
{
|
||||
if (rArgs.mpDXArray == nullptr)
|
||||
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)
|
||||
{
|
||||
|
@@ -691,12 +691,6 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, tools::Rectangle& rRect
|
||||
return bRet;
|
||||
}
|
||||
|
||||
GenericSalLayout::GenericSalLayout()
|
||||
{}
|
||||
|
||||
GenericSalLayout::~GenericSalLayout()
|
||||
{}
|
||||
|
||||
void GenericSalLayout::AppendGlyph( const GlyphItem& rGlyphItem )
|
||||
{
|
||||
m_GlyphItems.push_back(rGlyphItem);
|
||||
|
@@ -38,7 +38,7 @@
|
||||
|
||||
#include <cairo.h>
|
||||
#include <cairo-ft.h>
|
||||
#include <CommonSalLayout.hxx>
|
||||
#include <sallayout.hxx>
|
||||
|
||||
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();
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <unx/salgdi.h>
|
||||
#include <unx/salvd.h>
|
||||
#include <textrender.hxx>
|
||||
#include <CommonSalLayout.hxx>
|
||||
#include <sallayout.hxx>
|
||||
|
||||
GC
|
||||
X11SalGraphics::GetFontGC()
|
||||
@@ -53,7 +53,7 @@ X11SalGraphics::GetFontGC()
|
||||
return pFontGC_;
|
||||
}
|
||||
|
||||
void X11SalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
|
||||
void X11SalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
|
||||
{
|
||||
mxTextRenderImpl->DrawTextLayout(rLayout);
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@
|
||||
#include <PhysicalFontFace.hxx>
|
||||
#include <salbmp.hxx>
|
||||
#include <salprn.hxx>
|
||||
#include <CommonSalLayout.hxx>
|
||||
#include <sallayout.hxx>
|
||||
|
||||
using namespace psp;
|
||||
|
||||
@@ -529,12 +529,12 @@ ImplPspFontData::ImplPspFontData(const psp::FastPrintFontInfo& rInfo)
|
||||
mnFontId( rInfo.m_nID )
|
||||
{}
|
||||
|
||||
class PspCommonSalLayout : public CommonSalLayout
|
||||
class PspSalLayout : public GenericSalLayout
|
||||
{
|
||||
public:
|
||||
PspCommonSalLayout(psp::PrinterGfx&, FreetypeFont& rFont);
|
||||
PspSalLayout(psp::PrinterGfx&, FreetypeFont& rFont);
|
||||
|
||||
virtual void InitFont() const override;
|
||||
void InitFont() const final override;
|
||||
|
||||
private:
|
||||
::psp::PrinterGfx& mrPrinterGfx;
|
||||
@@ -546,8 +546,8 @@ private:
|
||||
bool mbArtBold;
|
||||
};
|
||||
|
||||
PspCommonSalLayout::PspCommonSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rFont)
|
||||
: CommonSalLayout(*rFont.GetFontInstance())
|
||||
PspSalLayout::PspSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rFont)
|
||||
: GenericSalLayout(*rFont.GetFontInstance())
|
||||
, mrPrinterGfx(rGfx)
|
||||
{
|
||||
mnFontID = mrPrinterGfx.GetFontID();
|
||||
@@ -558,14 +558,14 @@ PspCommonSalLayout::PspCommonSalLayout(::psp::PrinterGfx& rGfx, FreetypeFont& rF
|
||||
mbArtBold = mrPrinterGfx.GetArtificialBold();
|
||||
}
|
||||
|
||||
void PspCommonSalLayout::InitFont() const
|
||||
void PspSalLayout::InitFont() const
|
||||
{
|
||||
CommonSalLayout::InitFont();
|
||||
GenericSalLayout::InitFont();
|
||||
mrPrinterGfx.SetFont(mnFontID, mnFontHeight, mnFontWidth,
|
||||
mnOrientation, mbVertical, mbArtItalic, mbArtBold);
|
||||
}
|
||||
|
||||
void GenPspGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
|
||||
void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
|
||||
{
|
||||
const GlyphItem* pGlyph;
|
||||
Point aPos;
|
||||
@@ -763,7 +763,7 @@ bool GenPspGraphics::GetGlyphOutline(const GlyphItem& rGlyph,
|
||||
std::unique_ptr<SalLayout> GenPspGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs*/, int 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;
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <sft.hxx>
|
||||
#include <sallayout.hxx>
|
||||
#include <CommonSalLayout.hxx>
|
||||
|
||||
#include <shlwapi.h>
|
||||
#include <winver.h>
|
||||
@@ -233,7 +232,7 @@ HRESULT D2DWriteTextOutRenderer::BindDC(HDC hDC, tools::Rectangle const & rRect)
|
||||
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 bResult = false;
|
||||
@@ -247,7 +246,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const & rLayout, SalGr
|
||||
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())
|
||||
return false;
|
||||
|
@@ -35,7 +35,6 @@
|
||||
|
||||
#include <sft.hxx>
|
||||
#include <sallayout.hxx>
|
||||
#include <CommonSalLayout.hxx>
|
||||
#include <win/ScopedHDC.hxx>
|
||||
|
||||
#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*/,
|
||||
HDC hDC)
|
||||
{
|
||||
@@ -234,7 +233,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
|
||||
HFONT hAltFont = nullptr;
|
||||
bool bUseAltFont = false;
|
||||
bool bShift = false;
|
||||
if (rLayout.getFont().GetFontSelectPattern().mbVertical)
|
||||
if (rLayout.GetFont().GetFontSelectPattern().mbVertical)
|
||||
{
|
||||
LOGFONTW aLogFont;
|
||||
GetObjectW(hFont, sizeof(aLogFont), &aLogFont);
|
||||
@@ -291,7 +290,7 @@ std::unique_ptr<SalLayout> WinSalGraphics::GetTextLayout(ImplLayoutArgs& /*rArgs
|
||||
assert(mpWinFontEntry[nFallbackLevel]->GetFontFace());
|
||||
|
||||
mpWinFontEntry[nFallbackLevel]->SetHDC(getHDC());
|
||||
CommonSalLayout *aLayout = new CommonSalLayout(*mpWinFontEntry[nFallbackLevel]);
|
||||
GenericSalLayout *aLayout = new GenericSalLayout(*mpWinFontEntry[nFallbackLevel]);
|
||||
return std::unique_ptr<SalLayout>(aLayout);
|
||||
}
|
||||
|
||||
@@ -381,14 +380,14 @@ void WinFontInstance::SetHDC(const 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);
|
||||
if (!bDoGlyphCaching)
|
||||
return false;
|
||||
|
||||
HDC hDC = getHDC();
|
||||
WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.getFont());
|
||||
WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.GetFont());
|
||||
|
||||
int nStart = 0;
|
||||
Point aPos(0, 0);
|
||||
@@ -405,7 +404,7 @@ bool WinSalGraphics::CacheGlyphs(const CommonSalLayout& rLayout)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout)
|
||||
bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout)
|
||||
{
|
||||
HDC hDC = getHDC();
|
||||
|
||||
@@ -419,7 +418,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout)
|
||||
if (!pImpl)
|
||||
return false;
|
||||
|
||||
WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.getFont());
|
||||
WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.GetFont());
|
||||
|
||||
int nStart = 0;
|
||||
Point aPos(0, 0);
|
||||
@@ -444,22 +443,22 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout)
|
||||
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);
|
||||
render(rLayout, *this, hDC);
|
||||
}
|
||||
|
||||
void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
|
||||
void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
|
||||
{
|
||||
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);
|
||||
|
||||
// Our DirectWrite renderer is incomplete, skip it for non-horizontal or
|
||||
// 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;
|
||||
if (!bUseOpenGL)
|
||||
|
Reference in New Issue
Block a user