summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-10-30 19:05:41 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-11-06 12:05:32 +0100
commitb66a7cbd8491fe436126e11975c360f47ae346ed (patch)
treea8dce4ec9526d69a5c4c8640e3728dc3723c9065
parent185c9724fd8445695f9233f8120c71e80392767d (diff)
QT5 first stab on implementing CommonSalLayout
CommonSalLayout doesn't rally have an interface. It's cluttered with #ifdefs. Currently we have to move the Qt5Font into the VCL library. Someone should refactor this... Doen't render any text yet, but reports some sizes. Eventually that would cut down the public interface again. Change-Id: I12f32affb05b37e070c6cbc80db01779f84590b6
-rw-r--r--config_host/config_qt5.h.in1
-rw-r--r--vcl/CustomTarget_qt5_moc.mk4
-rw-r--r--vcl/Library_vcl.mk18
-rw-r--r--vcl/Library_vclplug_qt5.mk13
-rw-r--r--vcl/inc/CommonSalLayout.hxx27
-rw-r--r--vcl/inc/impfontmetricdata.hxx2
-rw-r--r--vcl/inc/qt5/Qt5Font.hxx43
-rw-r--r--vcl/qt5/Qt5Font.cxx26
-rw-r--r--vcl/qt5/Qt5FontFace.cxx4
-rw-r--r--vcl/qt5/Qt5FontFace.hxx12
-rw-r--r--vcl/qt5/Qt5Graphics.cxx9
-rw-r--r--vcl/qt5/Qt5Graphics.hxx8
-rw-r--r--vcl/qt5/Qt5Graphics_Text.cxx54
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx76
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx2
15 files changed, 261 insertions, 38 deletions
diff --git a/config_host/config_qt5.h.in b/config_host/config_qt5.h.in
index cdce1af7800c..51bb58566f2b 100644
--- a/config_host/config_qt5.h.in
+++ b/config_host/config_qt5.h.in
@@ -5,6 +5,7 @@ Settings for QT5 integration.
#ifndef CONFIG_QT5_H
#define CONFIG_QT5_H
+#define ENABLE_QT5 0
#define QT5_HAVE_GLIB 0
#endif
diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index 8d22eb6e9288..60d5df34d405 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -9,12 +9,12 @@
$(eval $(call gb_CustomTarget_CustomTarget,vcl/qt5))
-$(call gb_CustomTarget_get_target,vcl/unx/qt5) : \
+$(call gb_CustomTarget_get_target,vcl/qt5) : \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Instance.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Timer.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Widget.moc \
-$(call gb_CustomTarget_get_workdir,vcl/unx/qt5)/%.moc : \
+$(call gb_CustomTarget_get_workdir,vcl/qt5)/%.moc : \
$(SRCDIR)/vcl/qt5/%.hxx \
| $(call gb_CustomTarget_get_workdir,vcl/qt5)/.dir
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1)
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index cbe6de3afce7..699d6abd67f5 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -719,4 +719,22 @@ ifeq ($(OS),WNT)
$(eval $(call gb_Library_use_package,vcl,postprocess_images))
endif
+ifeq ($(ENABLE_QT5),TRUE)
+$(eval $(call gb_Library_use_externals,vcl,\
+ qt5 \
+))
+$(eval $(call gb_Library_add_defs,vcl,\
+ $(QT5_CFLAGS) \
+))
+$(eval $(call gb_Library_add_libs,vcl,\
+ $(QT5_LIBS) \
+))
+$(eval $(call gb_Library_add_cxxflags,vcl,\
+ $(QT5_CFLAGS) \
+))
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+ vcl/qt5/Qt5Font \
+))
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 333812f939bb..d82b7d2fcd31 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -53,11 +53,14 @@ $(eval $(call gb_Library_use_libraries,vclplug_qt5,\
))
$(eval $(call gb_Library_use_externals,vclplug_qt5,\
- boost_headers \
- cairo \
- icuuc \
- qt5 \
- epoxy \
+ boost_headers \
+ cairo \
+ epoxy \
+ graphite \
+ harfbuzz \
+ icu_headers \
+ icuuc \
+ qt5 \
))
$(eval $(call gb_Library_add_defs,vclplug_qt5,\
diff --git a/vcl/inc/CommonSalLayout.hxx b/vcl/inc/CommonSalLayout.hxx
index 02eef73a1dc8..a44fee5cfe10 100644
--- a/vcl/inc/CommonSalLayout.hxx
+++ b/vcl/inc/CommonSalLayout.hxx
@@ -20,6 +20,8 @@
#ifndef INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX
#define INCLUDED_VCL_INC_COMMONSALLAYOUT_HXX
+#include <config_qt5.h>
+
#include <com/sun/star/i18n/XBreakIterator.hpp>
#ifdef _WIN32
@@ -37,8 +39,19 @@
#include <hb-icu.h>
#include <hb-ot.h>
-class CommonSalLayout : public GenericSalLayout
+#if ENABLE_QT5
+class Qt5Font;
+#endif
+
+class VCL_DLLPUBLIC CommonSalLayout : public GenericSalLayout
{
+#if ENABLE_QT5
+ friend hb_blob_t* getFontTable(hb_face_t*, hb_tag_t, void*);
+ explicit CommonSalLayout(const FontSelectPattern &rFSP,
+ FreetypeFont *pFreetypeFont,
+ Qt5Font *pFont, bool bUseQt5);
+#endif
+
hb_font_t* mpHbFont;
const FontSelectPattern& mrFontSelData;
css::uno::Reference<css::i18n::XBreakIterator> mxBreak;
@@ -50,7 +63,11 @@ class CommonSalLayout : public GenericSalLayout
#elif defined(MACOSX) || defined(IOS)
const CoreTextStyle& mrCoreTextStyle;
#else
- FreetypeFont& mrFreetypeFont;
+ FreetypeFont* mpFreetypeFont;
+#if ENABLE_QT5
+ const bool mbUseQt5;
+ Qt5Font* mpQFont;
+#endif
#endif
void ParseFeatures(const OUString& name);
@@ -76,7 +93,11 @@ public:
const CoreTextStyle& getFontData() const { return mrCoreTextStyle; };
#else
explicit CommonSalLayout(FreetypeFont&);
- const FreetypeFont& getFontData() const { return mrFreetypeFont; };
+ const FreetypeFont* getFreetypeFont() const { return mpFreetypeFont; };
+#if ENABLE_QT5
+ explicit CommonSalLayout(Qt5Font&);
+ const Qt5Font* getQt5Font() const { return mpQFont; };
+#endif
#endif
virtual void InitFont() const override;
diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index 14ad323b9b77..fd15e5765164 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -32,7 +32,7 @@ typedef tools::SvRef<ImplFontMetricData> ImplFontMetricDataRef;
class OutputDevice;
class FontSelectPattern;
-class ImplFontMetricData : public FontAttributes, public SvRefBase
+class VCL_DLLPUBLIC ImplFontMetricData : public FontAttributes, public SvRefBase
{
public:
explicit ImplFontMetricData( const FontSelectPattern& );
diff --git a/vcl/inc/qt5/Qt5Font.hxx b/vcl/inc/qt5/Qt5Font.hxx
new file mode 100644
index 000000000000..d8981578831a
--- /dev/null
+++ b/vcl/inc/qt5/Qt5Font.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+#include <QtGui/QFont>
+
+#include <fontselect.hxx>
+#include <hb-ot.h>
+
+class VCL_DLLPUBLIC Qt5Font : public QFont
+{
+ const FontSelectPattern m_aFontSelData;
+ hb_font_t* m_pHbFont;
+
+public:
+ Qt5Font( const FontSelectPattern& rFSP)
+ : m_aFontSelData( rFSP ), m_pHbFont( nullptr ) {}
+ virtual ~Qt5Font();
+
+ hb_font_t* GetHbFont() const { return m_pHbFont; }
+ void SetHbFont( hb_font_t* pHbFont ) { m_pHbFont = pHbFont; }
+ const FontSelectPattern& GetFontSelData() const { return m_aFontSelData; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Font.cxx b/vcl/qt5/Qt5Font.cxx
new file mode 100644
index 000000000000..8ad5e2b0c040
--- /dev/null
+++ b/vcl/qt5/Qt5Font.cxx
@@ -0,0 +1,26 @@
+/* -*- 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 .
+ */
+
+#include <qt5/Qt5Font.hxx>
+
+Qt5Font::~Qt5Font()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx
index 701509b06108..347f6bb58ba5 100644
--- a/vcl/qt5/Qt5FontFace.cxx
+++ b/vcl/qt5/Qt5FontFace.cxx
@@ -65,7 +65,7 @@ sal_IntPtr Qt5FontFace::GetFontId() const
return reinterpret_cast<sal_IntPtr>( &m_aFontId );
}
-const FontCharMapRef Qt5FontFace::GetFontCharMap()
+const FontCharMapRef Qt5FontFace::GetFontCharMap() const
{
if( m_xCharMap.is() )
return m_xCharMap;
@@ -88,7 +88,7 @@ const FontCharMapRef Qt5FontFace::GetFontCharMap()
return m_xCharMap;
}
-bool Qt5FontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities)
+bool Qt5FontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
{
// read this only once per font
if( m_bFontCapabilitiesRead )
diff --git a/vcl/qt5/Qt5FontFace.hxx b/vcl/qt5/Qt5FontFace.hxx
index 76b8fdee99f1..7cfbdf8be702 100644
--- a/vcl/qt5/Qt5FontFace.hxx
+++ b/vcl/qt5/Qt5FontFace.hxx
@@ -44,8 +44,8 @@ public:
int GetFontTable( const char pTagName[5], unsigned char* ) const;
- const FontCharMapRef GetFontCharMap();
- bool GetFontCapabilities( vcl::FontCapabilities &rFontCapabilities );
+ const FontCharMapRef GetFontCharMap() const;
+ bool GetFontCapabilities( vcl::FontCapabilities &rFontCapabilities ) const;
bool HasChar( sal_uInt32 cChar ) const;
protected:
@@ -53,10 +53,10 @@ protected:
Qt5FontFace( const FontAttributes& rFA, const QString &rFontID );
private:
- const QString m_aFontId;
- FontCharMapRef m_xCharMap;
- vcl::FontCapabilities m_aFontCapabilities;
- bool m_bFontCapabilitiesRead;
+ const QString m_aFontId;
+ mutable FontCharMapRef m_xCharMap;
+ mutable vcl::FontCapabilities m_aFontCapabilities;
+ mutable bool m_bFontCapabilitiesRead;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index 1d0d15677eb4..aebb486c2453 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -30,6 +30,9 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame )
: m_pFrame( pFrame )
, m_pQImage( nullptr )
, m_pFontCollection( nullptr )
+ , m_pFontData{ nullptr, }
+ , m_pTextStyle{ nullptr, }
+ , m_aTextColor( MAKE_SALCOLOR(0x00, 0x00, 0x00) )
{
}
@@ -37,11 +40,17 @@ Qt5Graphics::Qt5Graphics( QImage *pQImage )
: m_pFrame( nullptr )
, m_pQImage( pQImage )
, m_pFontCollection( nullptr )
+ , m_pFontData{ nullptr, }
+ , m_pTextStyle{ nullptr, }
+ , m_aTextColor( MAKE_SALCOLOR(0x00, 0x00, 0x00) )
{
}
Qt5Graphics::~Qt5Graphics()
{
+ // release the text styles
+ for (int i = 0; i < MAX_FALLBACK; ++i)
+ delete m_pTextStyle[ i ];
}
void Qt5Graphics::PreparePainter()
diff --git a/vcl/qt5/Qt5Graphics.hxx b/vcl/qt5/Qt5Graphics.hxx
index b021134e54b7..d9f74a05b919 100644
--- a/vcl/qt5/Qt5Graphics.hxx
+++ b/vcl/qt5/Qt5Graphics.hxx
@@ -25,9 +25,10 @@
#include <QtGui/QRegion>
+class Qt5Font;
+class Qt5FontFace;
class Qt5Frame;
class PhysicalFontCollection;
-class PhysicalFontFace;
class QImage;
class QPainter;
@@ -39,8 +40,11 @@ class Qt5Graphics : public SalGraphics
QImage *m_pQImage;
QRegion m_aClipRegion;
std::unique_ptr< QPainter > m_pPainter;
+
PhysicalFontCollection *m_pFontCollection;
- PhysicalFontFace *m_pFont;
+ const Qt5FontFace *m_pFontData[ MAX_FALLBACK ];
+ Qt5Font *m_pTextStyle[ MAX_FALLBACK ];
+ SalColor m_aTextColor;
void PreparePainter();
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index fe6931c84458..0053a56c412d 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -19,34 +19,78 @@
#include "Qt5Graphics.hxx"
#include "Qt5FontFace.hxx"
+#include <qt5/Qt5Font.hxx>
#include <vcl/fontcharmap.hxx>
+#include <CommonSalLayout.hxx>
#include <PhysicalFontCollection.hxx>
#include <QtGui/QFontDatabase>
+#include <QtGui/QRawFont>
#include <QtCore/QStringList>
void Qt5Graphics::SetTextColor( SalColor nSalColor )
{
+ m_aTextColor = nSalColor;
}
-void Qt5Graphics::SetFont( const FontSelectPattern*, int nFallbackLevel )
+void Qt5Graphics::SetFont( const FontSelectPattern* pReqFont, int nFallbackLevel )
{
+ // release the text styles
+ for (int i = nFallbackLevel; i < MAX_FALLBACK; ++i)
+ {
+ if ( !m_pTextStyle[ i ] )
+ break;
+ delete m_pTextStyle[ i ];
+ m_pTextStyle[ i ] = nullptr;
+ }
+
+ if( !pReqFont )
+ // handle release-font-resources request
+ m_pFontData[ nFallbackLevel ] = nullptr;
+ else
+ {
+ m_pFontData[ nFallbackLevel ] = static_cast<const Qt5FontFace*>( pReqFont->mpFontData );
+ m_pTextStyle[ nFallbackLevel ] = new Qt5Font( *pReqFont );
+ }
}
void Qt5Graphics::GetFontMetric( ImplFontMetricDataRef &rFMD, int nFallbackLevel )
{
+ QRawFont aRawFont( QRawFont::fromFont( *m_pTextStyle[ nFallbackLevel ] ) );
+
+ QByteArray aHheaTable = aRawFont.fontTable( "hhea" );
+ std::vector<uint8_t> rHhea(aHheaTable.data(), aHheaTable.data() + aHheaTable.size() );
+
+ QByteArray aOs2Table = aRawFont.fontTable( "OS/2" );
+ std::vector<uint8_t> rOS2(aHheaTable.data(), aHheaTable.data() + aHheaTable.size() );
+
+ rFMD->ImplCalcLineSpacing( rHhea, rOS2, aRawFont.unitsPerEm() );
+
+ rFMD->SetWidth( aRawFont.averageCharWidth() );
+
+ const QChar nKashidaCh[ 2 ] = { 0x06, 0x40 };
+ quint32 nKashidaGid = 0;
+ QPointF aPoint;
+ int nNumGlyphs;
+ if( aRawFont.glyphIndexesForChars( nKashidaCh, 1, &nKashidaGid, &nNumGlyphs )
+ && aRawFont.advancesForGlyphIndexes( &nKashidaGid, &aPoint, 1 ) )
+ rFMD->SetMinKashida( lrint(aPoint.rx()) );
}
const FontCharMapRef Qt5Graphics::GetFontCharMap() const
{
- return nullptr;
+ if( !m_pFontData[ 0 ] )
+ return FontCharMapRef( new FontCharMap() );
+ return m_pFontData[ 0 ]->GetFontCharMap();
}
bool Qt5Graphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
{
- return false;
+ if( !m_pFontData[ 0 ] )
+ return false;
+ return m_pFontData[ 0 ]->GetFontCapabilities( rFontCapabilities );
}
void Qt5Graphics::GetDevFontList( PhysicalFontCollection* pPFC )
@@ -90,7 +134,7 @@ void Qt5Graphics::FreeEmbedFontData( const void* pData, long nDataLen )
{
}
-void Qt5Graphics::GetGlyphWidths( const PhysicalFontFace*, bool bVertical,
+void Qt5Graphics::GetGlyphWidths( const PhysicalFontFace* pPFF, bool bVertical,
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc )
{
@@ -108,6 +152,8 @@ bool Qt5Graphics::GetGlyphOutline( const GlyphItem&, basegfx::B2DPolyPolygon& )
SalLayout* Qt5Graphics::GetTextLayout( ImplLayoutArgs&, int nFallbackLevel )
{
+ if( m_pTextStyle[ nFallbackLevel ] )
+ return new CommonSalLayout( *m_pTextStyle[ nFallbackLevel ] );
return nullptr;
}
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 4f896e694b59..132766753174 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -29,7 +29,14 @@
#include <unicode/uchar.h>
#include <android/compatibility.hxx>
-static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData)
+#if ENABLE_QT5
+#include <qt5/Qt5Font.hxx>
+#include <QtGui/QRawFont>
+#else
+class Qt5Font;
+#endif
+
+hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData)
{
char pTagName[5];
pTagName[0] = (char)(nTableTag >> 24);
@@ -62,9 +69,23 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
pFont->GetFontTable(pTagName, pBuffer);
}
#else
- const unsigned char* pBuffer = nullptr;
- FreetypeFont* pFont = static_cast<FreetypeFont*>(pUserData);
- pBuffer = pFont->GetTable(pTagName, &nLength);
+ const char* pBuffer = nullptr;
+ CommonSalLayout *pLayout = static_cast<CommonSalLayout*>( pUserData );
+#if ENABLE_QT5
+ QByteArray aTable;
+ if ( pLayout->mbUseQt5 )
+ {
+ QRawFont aRawFont( QRawFont::fromFont( *pLayout->mpQFont ) );
+ aTable = aRawFont.fontTable( pTagName );
+ pBuffer = reinterpret_cast<const char*>( aTable.data() );
+ nLength = aTable.size();
+ }
+ else
+#endif
+ {
+ pBuffer = reinterpret_cast<const char*>(
+ pLayout->mpFreetypeFont->GetTable(pTagName, &nLength) );
+ }
#endif
hb_blob_t* pBlob = nullptr;
@@ -73,7 +94,7 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
pBlob = hb_blob_create(reinterpret_cast<const char*>(pBuffer), nLength, HB_MEMORY_MODE_READONLY,
pBuffer, [](void* data){ delete[] static_cast<unsigned char*>(data); });
#else
- pBlob = hb_blob_create(reinterpret_cast<const char*>(pBuffer), nLength, HB_MEMORY_MODE_READONLY, nullptr, nullptr);
+ pBlob = hb_blob_create(pBuffer, nLength, HB_MEMORY_MODE_READONLY, nullptr, nullptr);
#endif
return pBlob;
@@ -234,20 +255,51 @@ CommonSalLayout::CommonSalLayout(const CoreTextStyle& rCoreTextStyle)
}
#else
-CommonSalLayout::CommonSalLayout(FreetypeFont& rFreetypeFont)
-: mrFontSelData(rFreetypeFont.GetFontSelData())
-, mrFreetypeFont(rFreetypeFont)
-, mpVertGlyphs(nullptr)
+
+CommonSalLayout::CommonSalLayout(const FontSelectPattern &rFSP,
+ FreetypeFont *pFreetypeFont,
+ Qt5Font *pQt5Font, bool bUseQt5)
+ : mrFontSelData(rFSP)
+ , mpFreetypeFont(pFreetypeFont)
+#if ENABLE_QT5
+ , mbUseQt5(bUseQt5)
+ , mpQFont(pQt5Font)
+#endif
+ , mpVertGlyphs(nullptr)
{
- mpHbFont = rFreetypeFont.GetHbFont();
+#if ENABLE_QT5
+ if (mbUseQt5)
+ mpHbFont = mpQFont->GetHbFont();
+ else
+#endif
+ mpHbFont = mpFreetypeFont->GetHbFont();
if (!mpHbFont)
{
- hb_face_t* pHbFace = hb_face_create_for_tables(getFontTable, &rFreetypeFont, nullptr);
+ hb_face_t* pHbFace = hb_face_create_for_tables(getFontTable, this, nullptr);
mpHbFont = createHbFont(pHbFace);
- mrFreetypeFont.SetHbFont(mpHbFont);
+#if ENABLE_QT5
+ if (mbUseQt5)
+ mpQFont->SetHbFont(mpHbFont);
+ else
+#endif
+ mpFreetypeFont->SetHbFont(mpHbFont);
}
}
+
+CommonSalLayout::CommonSalLayout(FreetypeFont& rFreetypeFont)
+ : CommonSalLayout(rFreetypeFont.GetFontSelData(),
+ &rFreetypeFont, nullptr, false)
+{
+}
+
+#if ENABLE_QT5
+CommonSalLayout::CommonSalLayout(Qt5Font& rQFont)
+ : CommonSalLayout(rQFont.GetFontSelData(),
+ nullptr, &rQFont, true)
+{
+}
+#endif
#endif
void CommonSalLayout::InitFont() const
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 5b03eda92eef..d868ff701049 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -157,7 +157,7 @@ namespace
void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout)
{
- const FreetypeFont& rFont = rLayout.getFontData();
+ const FreetypeFont& rFont = *rLayout.getFreetypeFont();
std::vector<cairo_glyph_t> cairo_glyphs;
std::vector<int> glyph_extrarotation;