summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-03-10 11:16:10 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-03-18 10:47:35 +0100
commit64c6c4279f70555511af2d2ba80bcd32cbc7a798 (patch)
treebcd9ad4eeab2fd45d6c13d23c78f786ec0cd1ee9 /vcl/inc
parentf493cd83fbb2e572cf3d85aaf57fb202d763756d (diff)
move most font handling out of CairoTextRender
It doesn't really have anything to do with Cairo, it's FreeType, and it can be reused by other implementation (to be used by Skia). Change-Id: I02fe8b9d8cd9334741240a1198460c41543cd876 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90605 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/unx/cairotextrender.hxx42
-rw-r--r--vcl/inc/unx/freetypetextrender.hxx72
2 files changed, 74 insertions, 40 deletions
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 6b29041b9360..3879bf5d975d 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -20,17 +20,12 @@
#ifndef INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
#define INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
-#include <textrender.hxx>
+#include <unx/freetypetextrender.hxx>
-class FreetypeFont;
typedef struct _cairo cairo_t;
-class VCL_DLLPUBLIC CairoTextRender : public TextRenderImpl
+class VCL_DLLPUBLIC CairoTextRender : public FreeTypeTextRenderImpl
{
- FreetypeFont* mpFreetypeFont[ MAX_FALLBACK ];
-
- Color mnTextColor;
-
protected:
virtual cairo_t* getCairoContext() = 0;
virtual void getSurfaceOffset(double& nDX, double& nDY) = 0;
@@ -39,40 +34,7 @@ protected:
virtual void clipRegion(cairo_t* cr) = 0;
public:
- CairoTextRender();
- virtual ~CairoTextRender() override;
-
- virtual void SetTextColor( Color nColor ) override;
- virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
- virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
- virtual FontCharMapRef GetFontCharMap() const override;
- virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
- virtual void GetDevFontList( PhysicalFontCollection* ) override;
- virtual void ClearDevFontCache() override;
- virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
- virtual bool CreateFontSubset(
- const OUString& rToFile,
- const PhysicalFontFace*,
- const sal_GlyphId* pGlyphIDs,
- const sal_uInt8* pEncoding,
- sal_Int32* pWidths,
- int nGlyphs,
- FontSubsetInfo& rInfo) override;
-
- virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override;
- virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override;
- virtual void GetGlyphWidths(
- const PhysicalFontFace*,
- bool bVertical,
- std::vector< sal_Int32 >& rWidths,
- Ucs2UIntMap& rUnicodeEnc ) override;
-
- virtual std::unique_ptr<GenericSalLayout>
- GetTextLayout(int nFallbackLevel) override;
virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override;
-#if ENABLE_CAIRO_CANVAS
- virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override;
-#endif
};
#endif
diff --git a/vcl/inc/unx/freetypetextrender.hxx b/vcl/inc/unx/freetypetextrender.hxx
new file mode 100644
index 000000000000..c4abba43dfdc
--- /dev/null
+++ b/vcl/inc/unx/freetypetextrender.hxx
@@ -0,0 +1,72 @@
+/* -*- 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_UNX_FREETYPETEXTRENDER_HXX
+#define INCLUDED_VCL_INC_UNX_FREETYPETEXTRENDER_HXX
+
+#include <textrender.hxx>
+
+class FreetypeFont;
+
+// Generic implementation that uses freetype, but DrawTextLayout()
+// still needs implementing (e.g. by Cairo or Skia).
+class VCL_DLLPUBLIC FreeTypeTextRenderImpl : public TextRenderImpl
+{
+protected:
+ FreetypeFont* mpFreetypeFont[ MAX_FALLBACK ];
+
+ Color mnTextColor;
+
+public:
+ FreeTypeTextRenderImpl();
+ virtual ~FreeTypeTextRenderImpl() override;
+
+ virtual void SetTextColor( Color nColor ) override;
+ virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
+ virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
+ virtual FontCharMapRef GetFontCharMap() const override;
+ virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
+ virtual void GetDevFontList( PhysicalFontCollection* ) override;
+ virtual void ClearDevFontCache() override;
+ virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
+ virtual bool CreateFontSubset(
+ const OUString& rToFile,
+ const PhysicalFontFace*,
+ const sal_GlyphId* pGlyphIDs,
+ const sal_uInt8* pEncoding,
+ sal_Int32* pWidths,
+ int nGlyphs,
+ FontSubsetInfo& rInfo) override;
+
+ virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override;
+ virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override;
+ virtual void GetGlyphWidths(
+ const PhysicalFontFace*,
+ bool bVertical,
+ std::vector< sal_Int32 >& rWidths,
+ Ucs2UIntMap& rUnicodeEnc ) override;
+
+ virtual std::unique_ptr<GenericSalLayout>
+ GetTextLayout(int nFallbackLevel) override;
+ virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */