diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-08-16 12:13:18 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-08-16 13:50:25 +0200 |
commit | 88e601188c6902769e0c8f2ecfd2ade5c4f27703 (patch) | |
tree | ffb366237488249b8f13f15a9970c4f3a9971e22 /vcl/inc/sallayout.hxx | |
parent | 0a99baa1f96b4baf5be7c776c7fb2e5e7c94a351 (diff) |
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 'vcl/inc/sallayout.hxx')
-rw-r--r-- | vcl/inc/sallayout.hxx | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 123c339b525a..2aa650a1c75a 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -165,58 +165,6 @@ private: bool mbIncomplete; }; -typedef sal_uInt16 sal_GlyphId; - -struct 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); } -}; - class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout { public: @@ -227,6 +175,7 @@ public: bool LayoutText(ImplLayoutArgs&) final override; void DrawText(SalGraphics&) const final override; std::shared_ptr<vcl::TextLayoutCache> CreateTextLayoutCache(OUString const&) const final override; + SalLayoutGlyphs GetGlyphs() const final override; bool IsKashidaPosValid(int nCharPos) const final override; @@ -267,7 +216,7 @@ private: rtl::Reference<LogicalFontInstance> const mpFont; css::uno::Reference<css::i18n::XBreakIterator> mxBreak; - std::vector<GlyphItem> m_GlyphItems; + SalLayoutGlyphs m_GlyphItems; OString msLanguage; std::vector<hb_feature_t> maFeatures; |