diff options
author | Jonathan Clark <jonathan@libreoffice.org> | 2024-06-04 02:03:09 -0600 |
---|---|---|
committer | Jonathan Clark <jonathan@libreoffice.org> | 2024-06-06 12:09:06 +0200 |
commit | 0eedac9d666659a0e4b4892cff36a735db10c81f (patch) | |
tree | 8b6501b1e9d19f2660bf22ef1985dd9c02687637 /vcl/inc | |
parent | d106539f8f9a871ba081082291a6976d294aef58 (diff) |
tdf#161397 Fix incorrect glyphs for RTL font fallback
This change fixes an issue causing incorrect font fallback for certain
RTL grapheme clusters.
Change-Id: I6cff7f175b766d40c4faf204d1d65c8c366eb3e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168410
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/ImplLayoutRuns.hxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/vcl/inc/ImplLayoutRuns.hxx b/vcl/inc/ImplLayoutRuns.hxx index fecf1957d5f2..33f9048924fd 100644 --- a/vcl/inc/ImplLayoutRuns.hxx +++ b/vcl/inc/ImplLayoutRuns.hxx @@ -25,17 +25,29 @@ // used for managing runs e.g. for BiDi, glyph and script fallback class VCL_DLLPUBLIC ImplLayoutRuns { -private: +public: struct Run { int m_nMinRunPos; int m_nEndRunPos; bool m_bRTL; - Run(int nMinRunPos, int nEndRunPos, bool bRTL); - bool Contains(int nCharPos) const; + Run(int nMinRunPos, int nEndRunPos, bool bRTL) + : m_nMinRunPos(nMinRunPos) + , m_nEndRunPos(nEndRunPos) + , m_bRTL(bRTL) + { + } + + inline bool Contains(int nCharPos) const + { + return (m_nMinRunPos <= nCharPos) && (nCharPos < m_nEndRunPos); + } + + bool operator==(const Run&) const = default; }; +private: int mnRunIndex; boost::container::small_vector<Run, 8> maRuns; @@ -46,6 +58,9 @@ public: void AddPos(int nCharPos, bool bRTL); void AddRun(int nMinRunPos, int nEndRunPos, bool bRTL); + void Normalize(); + void ReverseTail(size_t nTailIndex); + bool IsEmpty() const { return maRuns.empty(); } void ResetPos() { mnRunIndex = 0; } void NextRun() { ++mnRunIndex; } @@ -56,6 +71,10 @@ public: inline auto begin() const { return maRuns.begin(); } inline auto end() const { return maRuns.end(); } + inline const auto& at(size_t nIndex) const { return maRuns.at(nIndex); } + inline auto size() const { return maRuns.size(); } + + static void PrepareFallbackRuns(ImplLayoutRuns* paRuns, ImplLayoutRuns* paFallbackRuns); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |