summaryrefslogtreecommitdiffstats
path: root/include/vcl/vcllayout.hxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-08-16 12:13:18 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-08-16 13:50:25 +0200
commit88e601188c6902769e0c8f2ecfd2ade5c4f27703 (patch)
treeffb366237488249b8f13f15a9970c4f3a9971e22 /include/vcl/vcllayout.hxx
parent-Werror,-Wmultichar (clang-cl) (diff)
downloadcore-88e601188c6902769e0c8f2ecfd2ade5c4f27703.tar.gz
core-88e601188c6902769e0c8f2ecfd2ade5c4f27703.zip
vcl: introduce a SalLayoutFlags::GlyphItemsOnly
OutputDevice::ImplLayout() does a number of things: first it calls the expensive SalLayout::LayoutText(), then it does a number of remaing tweaks to the resulting SalLayout based on the rLogicalPos and pDXArray parameters. This means that the resulting layout is not easy to reuse for Writer purposes, as it typically operates with the same text multiple times, but with different LogicalPos/DXArray. Add a new flag that returns the glyph items early, with the hope that this way the result only depends on the output device state and the string only, nothing else. Change-Id: I7c4a23d0f230495c8ba0ebbd1cfc3421e4a6e43c Reviewed-on: https://gerrit.libreoffice.org/59159 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'include/vcl/vcllayout.hxx')
-rw-r--r--include/vcl/vcllayout.hxx57
1 files changed, 56 insertions, 1 deletions
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index d9d4e0c42b99..ac61892fb415 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_VCL_VCLLAYOUT_HXX
#include <memory>
+#include <vector>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <tools/gen.hxx>
@@ -30,12 +31,65 @@
class ImplLayoutArgs;
class PhysicalFontFace;
class SalGraphics;
-struct GlyphItem;
namespace vcl
{
class TextLayoutCache;
}
+typedef sal_uInt16 sal_GlyphId;
+
+struct VCL_DLLPUBLIC GlyphItem
+{
+ int mnFlags;
+ int mnCharPos; // index in string
+ int mnCharCount; // number of characters making up this glyph
+
+ int mnOrigWidth; // original glyph width
+ int mnNewWidth; // width after adjustments
+ int mnXOffset;
+
+ sal_GlyphId maGlyphId;
+ Point maLinearPos; // absolute position of non rotated string
+
+ int mnFallbackLevel;
+
+public:
+ GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, const Point& rLinearPos,
+ long nFlags, int nOrigWidth, int nXOffset )
+ : mnFlags(nFlags)
+ , mnCharPos(nCharPos)
+ , mnCharCount(nCharCount)
+ , mnOrigWidth(nOrigWidth)
+ , mnNewWidth(nOrigWidth)
+ , mnXOffset(nXOffset)
+ , maGlyphId(aGlyphId)
+ , maLinearPos(rLinearPos)
+ , mnFallbackLevel(0)
+ { }
+
+ enum {
+ IS_IN_CLUSTER = 0x001,
+ IS_RTL_GLYPH = 0x002,
+ IS_DIACRITIC = 0x004,
+ IS_VERTICAL = 0x008,
+ IS_SPACING = 0x010,
+ ALLOW_KASHIDA = 0x020,
+ IS_DROPPED = 0x040,
+ IS_CLUSTER_START = 0x080
+ };
+
+ bool IsInCluster() const { return ((mnFlags & IS_IN_CLUSTER) != 0); }
+ bool IsRTLGlyph() const { return ((mnFlags & IS_RTL_GLYPH) != 0); }
+ bool IsDiacritic() const { return ((mnFlags & IS_DIACRITIC) != 0); }
+ bool IsVertical() const { return ((mnFlags & IS_VERTICAL) != 0); }
+ bool IsSpacing() const { return ((mnFlags & IS_SPACING) != 0); }
+ bool AllowKashida() const { return ((mnFlags & ALLOW_KASHIDA) != 0); }
+ bool IsDropped() const { return ((mnFlags & IS_DROPPED) != 0); }
+ bool IsClusterStart() const { return ((mnFlags & IS_CLUSTER_START) != 0); }
+};
+
+typedef std::vector<GlyphItem> SalLayoutGlyphs;
+
// all positions/widths are in font units
// one exception: drawposition is in pixel units
@@ -105,6 +159,7 @@ public:
virtual std::shared_ptr<vcl::TextLayoutCache>
CreateTextLayoutCache(OUString const&) const;
+ virtual SalLayoutGlyphs GetGlyphs() const;
protected:
// used by layout engines