summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2018-10-28 13:41:10 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2018-10-30 20:42:19 +0100
commit996d7f36ddcd6d518f4b44d132b3c5e3300f0c24 (patch)
tree5fb211f185c06dac6c2ff620b4c5982dca25dc86 /vcl/inc
parent0ea92ad5332ddb6583c82275071c3be3939ebf28 (diff)
Move SalGraphics glyph functions into FontInstance
As we already rely on the GlyphItem's font instance, consequently this removes the SalGraphics GlyphItem based functions. Also unifies the glyph bound rect cache handling. An interesting aspect is the rotated glyph bounding box handling moved from CairoTextRender to FreetypeFont. It doesn't look like an implementation detail for Cairo, so it may have been a bug. Change-Id: I81bbb5d8ee98fb77a1eee05568c456f9e4553023 Reviewed-on: https://gerrit.libreoffice.org/62503 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/PhysicalFontFace.hxx2
-rw-r--r--vcl/inc/fontinstance.hxx6
-rw-r--r--vcl/inc/headless/svpgdi.hxx2
-rw-r--r--vcl/inc/impglyphitem.hxx12
-rw-r--r--vcl/inc/qt5/Qt5Font.hxx3
-rw-r--r--vcl/inc/qt5/Qt5Graphics.hxx3
-rw-r--r--vcl/inc/quartz/salgdi.h11
-rw-r--r--vcl/inc/salgdi.hxx3
-rw-r--r--vcl/inc/sallayout.hxx2
-rw-r--r--vcl/inc/textrender.hxx2
-rw-r--r--vcl/inc/unx/cairotextrender.hxx2
-rw-r--r--vcl/inc/unx/freetype_glyphcache.hxx11
-rw-r--r--vcl/inc/unx/genpspgraphics.h2
-rw-r--r--vcl/inc/unx/glyphcache.hxx4
-rw-r--r--vcl/inc/unx/salgdi.h2
-rw-r--r--vcl/inc/win/salgdi.h3
-rw-r--r--vcl/inc/win/winlayout.hxx7
17 files changed, 29 insertions, 48 deletions
diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index c350a6c81649..23af5be9169e 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -54,7 +54,7 @@ public:
class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes, public salhelper::SimpleReferenceObject
{
public:
- virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const;
+ virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const = 0;
int GetHeight() const { return mnHeight; }
int GetWidth() const { return mnWidth; }
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 6f171ce72e49..5e1d70ad9600 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -70,8 +70,8 @@ public: // TODO: make data members private
const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); }
const ImplFontCache* GetFontCache() const { return mpFontCache; }
- bool GetCachedGlyphBoundRect(sal_GlyphId, tools::Rectangle &) const;
- void CacheGlyphBoundRect(sal_GlyphId nID, tools::Rectangle &) const;
+ bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const;
+ virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const = 0;
int GetKashidaWidth();
@@ -81,6 +81,8 @@ public: // TODO: make data members private
protected:
explicit LogicalFontInstance(const PhysicalFontFace&, const FontSelectPattern&);
+ virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const = 0;
+
// Takes ownership of pHbFace.
hb_font_t* InitHbFont(hb_face_t* pHbFace) const;
virtual hb_font_t* ImplInitHbFont() { assert(false); return nullptr; }
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index d1a4d9264ecc..1b24f2fa8c5d 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -191,8 +191,6 @@ public:
bool bVertical,
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) override;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const GenericSalLayout& ) override;
diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx
index d4c944717419..4c7673ed2077 100644
--- a/vcl/inc/impglyphitem.hxx
+++ b/vcl/inc/impglyphitem.hxx
@@ -76,18 +76,18 @@ struct VCL_DLLPUBLIC GlyphItem
bool IsDropped() const { return ((m_nFlags & IS_DROPPED) != 0); }
bool IsClusterStart() const { return ((m_nFlags & IS_CLUSTER_START) != 0); }
- inline bool GetCachedGlyphBoundRect(tools::Rectangle& rRect) const;
- inline void CacheGlyphBoundRect(tools::Rectangle& rRect) const;
+ inline bool GetGlyphBoundRect(tools::Rectangle&) const;
+ inline bool GetGlyphOutline(basegfx::B2DPolyPolygon&) const;
};
-VCL_DLLPUBLIC bool GlyphItem::GetCachedGlyphBoundRect(tools::Rectangle& rRect) const
+VCL_DLLPUBLIC bool GlyphItem::GetGlyphBoundRect(tools::Rectangle& rRect) const
{
- return m_pFontInstance->GetCachedGlyphBoundRect(m_aGlyphId, rRect);
+ return m_pFontInstance->GetGlyphBoundRect(m_aGlyphId, rRect, IsVertical());
}
-VCL_DLLPUBLIC void GlyphItem::CacheGlyphBoundRect(tools::Rectangle& rRect) const
+VCL_DLLPUBLIC bool GlyphItem::GetGlyphOutline(basegfx::B2DPolyPolygon& rPoly) const
{
- m_pFontInstance->CacheGlyphBoundRect(m_aGlyphId, rRect);
+ return m_pFontInstance->GetGlyphOutline(m_aGlyphId, rPoly, IsVertical());
}
class SalLayoutGlyphsImpl : public std::vector<GlyphItem>
diff --git a/vcl/inc/qt5/Qt5Font.hxx b/vcl/inc/qt5/Qt5Font.hxx
index de5cd16039f1..0720be93112b 100644
--- a/vcl/inc/qt5/Qt5Font.hxx
+++ b/vcl/inc/qt5/Qt5Font.hxx
@@ -30,6 +30,9 @@ class Qt5Font final : public QFont, public LogicalFontInstance
friend rtl::Reference<LogicalFontInstance>
Qt5FontFace::CreateFontInstance(const FontSelectPattern&) const;
+ bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override;
+ bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override;
+
virtual hb_font_t* ImplInitHbFont() override;
explicit Qt5Font(const PhysicalFontFace&, const FontSelectPattern&);
diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx
index 76c39146728c..d60a42c8c496 100644
--- a/vcl/inc/qt5/Qt5Graphics.hxx
+++ b/vcl/inc/qt5/Qt5Graphics.hxx
@@ -195,9 +195,6 @@ public:
virtual void GetGlyphWidths(const PhysicalFontFace*, bool bVertical,
std::vector<sal_Int32>& rWidths, Ucs2UIntMap& rUnicodeEnc) override;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
-
virtual std::unique_ptr<SalLayout> GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) override;
virtual void DrawTextLayout(const GenericSalLayout&) override;
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 0fb20bb490cc..b79bf4425534 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -77,7 +77,7 @@ private:
mutable bool mbFontCapabilitiesRead;
};
-class CoreTextStyle : public LogicalFontInstance
+class CoreTextStyle final : public LogicalFontInstance
{
friend rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPattern&) const;
@@ -85,8 +85,7 @@ public:
~CoreTextStyle() override;
void GetFontMetric( ImplFontMetricDataRef const & );
- bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&);
- bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) const;
+ bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override;
CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; }
@@ -98,7 +97,8 @@ public:
private:
explicit CoreTextStyle(const PhysicalFontFace&, const FontSelectPattern&);
- virtual hb_font_t* ImplInitHbFont() override;
+ hb_font_t* ImplInitHbFont() override;
+ bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override;
/// CoreText text style object
CFMutableDictionaryRef mpStyleDict;
@@ -373,9 +373,6 @@ public:
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) override;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
-
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const GenericSalLayout& ) override;
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index eb96cfa22a13..e2d6a62278eb 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -189,9 +189,6 @@ public:
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) = 0;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) = 0;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0;
-
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
virtual void DrawTextLayout( const GenericSalLayout& ) = 0;
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 56c25f9d70c4..cd2b02f105aa 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -133,7 +133,7 @@ public:
bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart,
const PhysicalFontFace** pFallbackFont = nullptr,
int* const pFallbackLevel = nullptr) const override;
- bool GetOutline(SalGraphics&, basegfx::B2DPolyPolygonVector&) const override;
+ bool GetOutline(basegfx::B2DPolyPolygonVector&) const override;
bool IsKashidaPosValid(int nCharPos) const override;
// used only by OutputDevice::ImplLayout, TODO: make friend
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index 33c803dba82b..31bcb04c7628 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -59,8 +59,6 @@ public:
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) = 0;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) = 0;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0;
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) = 0;
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 8d18836be91b..25272b92637e 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -75,8 +75,6 @@ public:
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) override;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout(const GenericSalLayout&, const SalGraphics&) override;
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index 58cd4eba38b1..774eec877957 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -107,6 +107,7 @@ class VCL_DLLPUBLIC FreetypeFontInstance : public LogicalFontInstance
FreetypeFont* mpFreetypeFont;
virtual hb_font_t* ImplInitHbFont() override;
+ virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override;
protected:
explicit FreetypeFontInstance(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP);
@@ -116,15 +117,9 @@ public:
void SetFreetypeFont(FreetypeFont* p);
FreetypeFont* GetFreetypeFont() const { return mpFreetypeFont; }
-};
-inline FreetypeFont* getFreetypeFontFromGlyph(const GlyphItem& rGlyph)
-{
- assert(rGlyph.m_pFontInstance);
- if (!rGlyph.m_pFontInstance)
- return nullptr;
- return static_cast<FreetypeFontInstance*>(rGlyph.m_pFontInstance)->GetFreetypeFont();
-}
+ virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override;
+};
#endif // INCLUDED_VCL_GENERIC_GLYPHS_GCACH_FTYP_HXX
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index bddcb888ebc6..e7314cb2ace3 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -111,8 +111,6 @@ public:
bool bVertical,
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) override;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const GenericSalLayout& ) override;
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 9fe3bd3dc7cf..185d42cb683d 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -111,8 +111,8 @@ public:
const FontCharMapRef GetFontCharMap() const;
bool GetFontCapabilities(vcl::FontCapabilities &) const;
- bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&);
- bool GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon&) const;
+ bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const;
+ bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const;
bool GetAntialiasAdvice() const;
FreetypeFontInstance* GetFontInstance() const { return mpFontInstance.get(); }
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 94f4a9a00a06..4fd30762d045 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -141,8 +141,6 @@ public:
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) override;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const GenericSalLayout& ) override;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index e8fe72cc4ca7..4b829f36d886 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -373,9 +373,6 @@ public:
std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc ) override;
- virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
- virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
-
virtual std::unique_ptr<SalLayout>
GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawTextLayout( const GenericSalLayout& ) override;
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index 036c1d3bcbbd..042e30e9f299 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -148,7 +148,7 @@ class WinFontInstance : public LogicalFontInstance
friend rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPattern&) const;
public:
- virtual ~WinFontInstance() override;
+ ~WinFontInstance() override;
bool hasHScale() const;
@@ -167,10 +167,13 @@ public:
bool CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, SalGraphics& rGraphics);
OpenGLGlyphCache& GetOpenGLGlyphCache() { return maOpenGLGlyphCache; }
+ bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override;
+
private:
explicit WinFontInstance(const WinFontFace&, const FontSelectPattern&);
- virtual hb_font_t* ImplInitHbFont() override;
+ hb_font_t* ImplInitHbFont() override;
+ bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override;
WinSalGraphics *m_pGraphics;
HFONT m_hFont;