summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-03-10 12:43:45 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-03-18 10:47:49 +0100
commit076926cef97c685b3d9221510e7560c034ebd2ed (patch)
tree9a7bf0c33ceb68575bea9e5683b6c9d40fbefb1e /vcl/inc
parent64c6c4279f70555511af2d2ba80bcd32cbc7a798 (diff)
implement text rendering using directly Skia (X11)
The Cairo-based way reuses code that is used for OpenGL, but it's needlessly complicated, given that Skia itself is capable of text rendering as well. This requires a small patch for Skia so that it uses the FcPattern* we use for selecting a font. The rendering with this commit is usable, but visually the result is noticeably different, so this will need tweaks to the font rendering (TBD). Change-Id: I058c282307106c929ccc9faa7b2bddfabf0f0a2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90580 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/skia/gdiimpl.hxx3
-rw-r--r--vcl/inc/skia/x11/textrender.hxx40
-rw-r--r--vcl/inc/unx/fc_fontoptions.hxx2
-rw-r--r--vcl/inc/unx/glyphcache.hxx4
4 files changed, 46 insertions, 3 deletions
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 46b3f7bcd334..a7de1cfc4872 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -32,6 +32,7 @@
#include <postwin.h>
class SkiaFlushIdle;
+class GenericSalLayout;
class VCL_DLLPUBLIC SkiaSalGraphicsImpl : public SalGraphicsImpl
{
@@ -202,6 +203,8 @@ public:
void drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& aBitmap,
SkBlendMode eBlendMode = SkBlendMode::kSrcOver);
+ void drawGenericLayout(const GenericSalLayout& layout, Color textColor, const SkFont& font);
+
protected:
// To be called before any drawing.
void preDraw();
diff --git a/vcl/inc/skia/x11/textrender.hxx b/vcl/inc/skia/x11/textrender.hxx
new file mode 100644
index 000000000000..2aeda63cfb5c
--- /dev/null
+++ b/vcl/inc/skia/x11/textrender.hxx
@@ -0,0 +1,40 @@
+/* -*- 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_SKIA_TEXTRENDER_HXX
+#define INCLUDED_VCL_INC_SKIA_TEXTRENDER_HXX
+
+#include <unx/freetypetextrender.hxx>
+
+#include <SkFontMgr.h>
+#include <SkFontMgr_fontconfig.h>
+
+class VCL_DLLPUBLIC SkiaTextRender : public FreeTypeTextRenderImpl
+{
+public:
+ virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override;
+ virtual void ClearDevFontCache() override;
+
+private:
+ sk_sp<SkFontMgr> fontManager;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/fc_fontoptions.hxx b/vcl/inc/unx/fc_fontoptions.hxx
index fe1bbef20452..de6ed2aba5df 100644
--- a/vcl/inc/unx/fc_fontoptions.hxx
+++ b/vcl/inc/unx/fc_fontoptions.hxx
@@ -23,7 +23,7 @@
#include <rtl/string.hxx>
typedef struct _FcPattern FcPattern;
-class FontConfigFontOptions
+class VCL_DLLPUBLIC FontConfigFontOptions
{
public:
FontConfigFontOptions(FcPattern* pPattern) :
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index d2352a4ffd44..38c51a036a1b 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -136,7 +136,7 @@ private:
FontFileList m_aFontFileList;
};
-class FreetypeFont final
+class VCL_DLLPUBLIC FreetypeFont final
{
public:
~FreetypeFont();
@@ -169,7 +169,7 @@ public:
// in starmath at a fairly low stretch ratio. This appears fixed in 2.9 with
// https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=91015cb41d8f56777f93394f5a60914bc0c0f330
// "Improve complex rendering at high ppem"
- static bool AlmostHorizontalDrainsRenderingPool();
+ static bool AlmostHorizontalDrainsRenderingPool(int nRatio, const FontSelectPattern& rFSD);
private:
friend class FreetypeManager;