[Libreoffice-commits] core.git: vcl/inc vcl/source

Khaled Hosny khaledhosny at eglug.org
Sat Nov 5 03:24:30 UTC 2016


 vcl/inc/sallayout.hxx              |    1 +
 vcl/source/gdi/CommonSalLayout.cxx |    5 +++++
 vcl/source/gdi/sallayout.cxx       |   23 +++++++++++++++++++++++
 3 files changed, 29 insertions(+)

New commits:
commit d9ea614a1e7c29bb6831822dc6fc29657d40bdd9
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Sat Nov 5 05:19:31 2016 +0200

    Validate Kashida positions with font fallback
    
    MultiSalLayout did not implement IsKashidaPosValid() which meant that
    whenever there is a font fallback no Kashida validation was performed.
    
    Change-Id: I30e498c356c49b0c06dd6b45187105f6bd758a24

diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 364bd48..2a76e11 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -243,6 +243,7 @@ public:
                                    int&, DeviceCoordinate* pGlyphAdvAry = nullptr, int* pCharPosAry = nullptr,
                                    const PhysicalFontFace** pFallbackFonts = nullptr ) const override;
     virtual bool    GetOutline( SalGraphics&, basegfx::B2DPolyPolygonVector& ) const override;
+    virtual bool    IsKashidaPosValid(int nCharPos) const override;
 
     // used only by OutputDevice::ImplLayout, TODO: make friend
     explicit        MultiSalLayout( SalLayout& rBaseLayout );
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index cb82bfa..e7ed549 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -751,6 +751,11 @@ bool CommonSalLayout::IsKashidaPosValid(int nCharPos) const
     {
         if (pIter->mnCharPos == nCharPos)
         {
+            // If the character was not supported by this layout, return false
+            // so that fallback layouts would be checked for it.
+            if (pIter->maGlyphId == 0)
+                break;
+
             // Search backwards for previous glyph belonging to a different
             // character. We are looking backwards because we are dealing with
             // RTL glyphs, which will be in visual order.
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index ef9bbc0..0034bca 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -2027,6 +2027,29 @@ bool MultiSalLayout::GetOutline( SalGraphics& rGraphics,
     return bRet;
 }
 
+bool MultiSalLayout::IsKashidaPosValid(int nCharPos) const
+{
+    // Check the base layout
+    bool bValid = mpLayouts[0]->IsKashidaPosValid(nCharPos);
+
+    // If base layout returned false, it might be because the character was not
+    // supported there, so we check fallback layouts.
+    if (!bValid)
+    {
+        for (int i = 1; i < mnLevel; ++i)
+        {
+            // - 1 because there is no fallback run for the base layout, IIUC.
+            if (maFallbackRuns[i - 1].PosIsInAnyRun(nCharPos))
+            {
+                bValid = mpLayouts[i]->IsKashidaPosValid(nCharPos);
+                break;
+            }
+        }
+    }
+
+    return bValid;
+}
+
 std::shared_ptr<vcl::TextLayoutCache> SalLayout::CreateTextLayoutCache(
         OUString const&) const
 {


More information about the Libreoffice-commits mailing list