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

Khaled Hosny khaledhosny at eglug.org
Sun Dec 11 00:25:48 UTC 2016


 vcl/inc/sallayout.hxx              |    6 +++---
 vcl/source/gdi/CommonSalLayout.cxx |    5 ++++-
 vcl/source/gdi/pdfwriter_impl.cxx  |    4 ++--
 vcl/source/gdi/sallayout.cxx       |   10 ----------
 vcl/source/outdev/font.cxx         |    2 +-
 vcl/source/outdev/textline.cxx     |    2 +-
 6 files changed, 11 insertions(+), 18 deletions(-)

New commits:
commit 869368e94dcfe393b0d06b1c1de18b5ce0d08d3d
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Thu Dec 8 07:00:02 2016 +0200

    Drop SalLayout::IsSpacingGlyph()
    
    Replace it with a check from ICU that actually makes sense.
    
    Change-Id: Ie8789444a967420d58f5575f42bc45677bfa96a1
    Reviewed-on: https://gerrit.libreoffice.org/31822
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index ee41051..447cc39 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -182,8 +182,6 @@ public:
     virtual bool    GetOutline( SalGraphics&, basegfx::B2DPolyPolygonVector& ) const;
     virtual bool    GetBoundRect( SalGraphics&, Rectangle& ) const;
 
-    static bool     IsSpacingGlyph( sal_GlyphId );
-
     // reference counting
     void            Release() const;
 
@@ -321,13 +319,15 @@ public:
         IS_RTL_GLYPH  = 0x002,
         IS_DIACRITIC  = 0x004,
         IS_VERTICAL   = 0x008,
-        ALLOW_KASHIDA = 0X010
+        IS_SPACING    = 0x010,
+        ALLOW_KASHIDA = 0x020
     };
 
     bool    IsClusterStart() 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); }
 };
 
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 27394c7..2c059ef 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -600,10 +600,13 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
                 if (u_getIntPropertyValue(aChar, UCHAR_GENERAL_CATEGORY) == U_NON_SPACING_MARK)
                     nGlyphFlags |= GlyphItem::IS_DIACRITIC;
 
+                if (u_isUWhiteSpace(aChar))
+                     nGlyphFlags |= GlyphItem::IS_SPACING;
+
                 if ((aSubRun.maScript == HB_SCRIPT_ARABIC ||
                      aSubRun.maScript == HB_SCRIPT_SYRIAC) &&
                     HB_DIRECTION_IS_BACKWARD(aSubRun.maDirection) &&
-                    !u_isUWhiteSpace(aChar))
+                    (nGlyphFlags & GlyphItem::IS_SPACING) == 0)
                 {
                     nGlyphFlags |= GlyphItem::ALLOW_KASHIDA;
                     rArgs.mnFlags |= SalLayoutFlags::KashidaJustification;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 241324d..75ba6d1 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8706,7 +8706,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
             int nStart = 0;
             while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
             {
-                if (!SalLayout::IsSpacingGlyph(pGlyph->maGlyphId))
+                if (!pGlyph->IsSpacing())
                 {
                     if( !nWidth )
                         aStartPt = aPos;
@@ -8803,7 +8803,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
         int nStart = 0;
         while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
         {
-            if (!SalLayout::IsSpacingGlyph(pGlyph->maGlyphId))
+            if (pGlyph->IsSpacing())
             {
                 Point aAdjOffset = aOffset;
                 aAdjOffset.X() += (pGlyph->mnNewWidth - nEmphWidth) / 2;
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 1567d60..877d7e5 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -722,16 +722,6 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, Rectangle& rRect ) cons
     return bRet;
 }
 
-// FIXME: This function is just broken, it assumes any glyph at index 3 in the
-// font is space, which though common is not a hard requirement and not the
-// only glyph for space characters. Fix the call sites and fix them.
-bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph )
-{
-    bool bRet = false;
-    bRet = (nGlyph == 3);
-    return bRet;
-}
-
 GenericSalLayout::GenericSalLayout()
 {}
 
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 3820d42..fe54a3d 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1303,7 +1303,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout )
         if (!mpGraphics->GetGlyphBoundRect(*pGlyph, aRectangle ) )
             continue;
 
-        if (!SalLayout::IsSpacingGlyph(pGlyph->maGlyphId))
+        if (!pGlyph->IsSpacing())
         {
             Point aAdjPoint = aOffset;
             aAdjPoint.X() += aRectangle.Left() + (aRectangle.GetWidth() - nEmphasisWidth) / 2;
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index c16fd4a..6ac0459 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -757,7 +757,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
         while (rSalLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
         {
             // calculate the boundaries of each word
-            if (!SalLayout::IsSpacingGlyph(pGlyph->maGlyphId))
+            if (!pGlyph->IsSpacing())
             {
                 if( !nWidth )
                 {


More information about the Libreoffice-commits mailing list