[Libreoffice-commits] core.git: Branch 'feature/glyphid-cleanup' - 2 commits - drawinglayer/source editeng/source include/vcl vcl/source

Khaled Hosny khaledhosny at eglug.org
Thu Dec 8 07:18:24 UTC 2016


Rebased ref, commits from common ancestor:
commit 16beef11eedac53ef59e24e4648bc132c604e511
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Thu Dec 8 07:17:00 2016 +0200

    Drop ComplexDisabled flags that does nothing
    
    There is no such thing as simple text layout in this brave new world.
    
    Change-Id: I641b7efa5ec8fdd9839c291e7f2fdb736361ef1e

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 900cada..b47d09f 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -262,7 +262,7 @@ namespace drawinglayer
 
                     if(rTextCandidate.getFontAttribute().getRTL())
                     {
-                        ComplexTextLayoutFlags nRTLLayoutMode(nOldLayoutMode & ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::ComplexDisabled|ComplexTextLayoutFlags::BiDiStrong));
+                        ComplexTextLayoutFlags nRTLLayoutMode(nOldLayoutMode & ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiStrong));
                         nRTLLayoutMode |= ComplexTextLayoutFlags::BiDiRtl|ComplexTextLayoutFlags::TextOriginLeft;
                         mpOutputDevice->SetLayoutMode(nRTLLayoutMode);
                     }
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 2331fe1..463582b 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -679,8 +679,6 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
         }
     }
 
-    // SW disables ComplexTextLayoutFlags::ComplexDisabled, so maybe I have to enable it...
-
     // Saving both layout mode and language (since I'm potentially changing both)
     GetRefDevice()->Push( PushFlags::TEXTLAYOUTMODE|PushFlags::TEXTLANGUAGE );
 
@@ -4255,14 +4253,14 @@ void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 nPara,
 
     if ( !bCTL && !bR2L)
     {
-        // No CTL/Bidi checking necessary
-        nLayoutMode |= ( ComplexTextLayoutFlags::ComplexDisabled | ComplexTextLayoutFlags::BiDiStrong );
+        // No Bidi checking necessary
+        nLayoutMode |= ComplexTextLayoutFlags::BiDiStrong;
     }
     else
     {
-        // CTL/Bidi checking necessary
+        // Bidi checking necessary
         // Don't use BIDI_STRONG, VCL must do some checks.
-        nLayoutMode &= ~ComplexTextLayoutFlags( ComplexTextLayoutFlags::ComplexDisabled | ComplexTextLayoutFlags::BiDiStrong );
+        nLayoutMode &= ~ComplexTextLayoutFlags( ComplexTextLayoutFlags::BiDiStrong );
 
         if ( bR2L )
             nLayoutMode |= ComplexTextLayoutFlags::BiDiRtl|ComplexTextLayoutFlags::TextOriginLeft;
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index a77e881..3e50f60 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -955,7 +955,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
 
                 // VCL will take care of brackets and so on...
                 ComplexTextLayoutFlags nLayoutMode = pOutDev->GetLayoutMode();
-                nLayoutMode &= ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiRtl|ComplexTextLayoutFlags::ComplexDisabled|ComplexTextLayoutFlags::BiDiStrong);
+                nLayoutMode &= ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiRtl|ComplexTextLayoutFlags::BiDiStrong);
                 if ( bRightToLeftPara )
                     nLayoutMode |= ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft | ComplexTextLayoutFlags::BiDiStrong;
                 pOutDev->SetLayoutMode( nLayoutMode );
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 15bdb8f..7cdda54 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -137,7 +137,6 @@ enum class SalLayoutFlags
     KerningPairs            = 0x0010,
     KerningAsian            = 0x0020,
     Vertical                = 0x0040,
-    ComplexDisabled         = 0x0100,
     EnableLigatures         = 0x0200,
     SubstituteDigits        = 0x0400,
     KashidaJustification    = 0x0800,
@@ -145,7 +144,7 @@ enum class SalLayoutFlags
 };
 namespace o3tl
 {
-    template<> struct typed_flags<SalLayoutFlags> : is_typed_flags<SalLayoutFlags, 0x2f77> {};
+    template<> struct typed_flags<SalLayoutFlags> : is_typed_flags<SalLayoutFlags, 0x2e77> {};
 }
 
 typedef std::vector< Rectangle > MetricVector;
diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 4a509a1..c1f42f6 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -67,11 +67,10 @@ enum class ComplexTextLayoutFlags
     BiDiStrong        = 0x0002,
     TextOriginLeft    = 0x0004,
     TextOriginRight   = 0x0008,
-    ComplexDisabled   = 0x0100,
     LigaturesEnabled  = 0x0200
 };
 namespace o3tl {
-    template<> struct typed_flags<ComplexTextLayoutFlags> : is_typed_flags<ComplexTextLayoutFlags, 0x030f> {};
+    template<> struct typed_flags<ComplexTextLayoutFlags> : is_typed_flags<ComplexTextLayoutFlags, 0x020f> {};
 }
 
 class OutDevState
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 4ba1f23..afaa2bf 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2938,7 +2938,7 @@ void TextEngine::ImpInitLayoutMode( OutputDevice* pOutDev )
 {
     ComplexTextLayoutFlags nLayoutMode = pOutDev->GetLayoutMode();
 
-    nLayoutMode &= ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::ComplexDisabled | ComplexTextLayoutFlags::BiDiStrong );
+    nLayoutMode &= ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::BiDiStrong );
 
     pOutDev->SetLayoutMode( nLayoutMode );
 }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a8833b2..da551d7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9416,7 +9416,7 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik
 
     // strikeout string is left aligned non-CTL text
     ComplexTextLayoutFlags nOrigTLM = m_pReferenceDevice->GetLayoutMode();
-    m_pReferenceDevice->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong|ComplexTextLayoutFlags::ComplexDisabled );
+    m_pReferenceDevice->SetLayoutMode(ComplexTextLayoutFlags::BiDiStrong);
 
     push( PushFlags::CLIPREGION );
     FontMetric aRefDevFontMetric = m_pReferenceDevice->GetFontMetric();
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 877d7e5..3f77bbc 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -71,7 +71,6 @@ std::ostream &operator <<(std::ostream& s, ImplLayoutArgs &rArgs)
         TEST(KerningPairs);
         TEST(KerningAsian);
         TEST(Vertical);
-        TEST(ComplexDisabled);
         TEST(EnableLigatures);
         TEST(SubstituteDigits);
         TEST(KashidaJustification);
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index c94b21d..73fc0a0 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1209,50 +1209,6 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
 
     if( mnTextLayoutMode & ComplexTextLayoutFlags::LigaturesEnabled )
         nLayoutFlags |= SalLayoutFlags::EnableLigatures;
-    else if( mnTextLayoutMode & ComplexTextLayoutFlags::ComplexDisabled )
-        nLayoutFlags |= SalLayoutFlags::ComplexDisabled;
-    else
-    {
-        // disable CTL for non-CTL text
-        const sal_Unicode* pStr = rStr.getStr() + nMinIndex;
-        const sal_Unicode* pEnd = rStr.getStr() + nEndIndex;
-        bool bIsCJKIdeograph = false;
-        for( ; pStr < pEnd; ++pStr )
-        {
-            if (pStr + 1 < pEnd && rtl::isHighSurrogate(pStr[0]) && rtl::isLowSurrogate(pStr[1]))
-            {
-                sal_uInt32 nCode = rtl::combineSurrogates( pStr[0] , pStr[1] );
-                if ( !bIsCJKIdeograph && nCode >= 0xE0100 && nCode < 0xE01F0 ) // Variation Selector Supplements
-                    break;
-
-                if ( nCode >= 0x20000 && nCode <= 0x2CEB0 )// CJK Unified Ideographs Extension B-E
-                    bIsCJKIdeograph = true;
-                ++pStr;
-                continue;
-            }
-
-            if ( ((*pStr >= 0xF900) && (*pStr < 0xFB00))  // CJK Compatibility Ideographs
-            ||   ((*pStr >= 0x3400) && (*pStr < 0xA000))  // CJK Unified Ideographs and Extension A
-            )
-            {
-                bIsCJKIdeograph = true;
-                continue;
-            }
-
-            if( ((*pStr >= 0x0300) && (*pStr < 0x0370))   // diacritical marks
-            ||  ((*pStr >= 0x0590) && (*pStr < 0x10A0))   // many CTL scripts
-            ||  ((*pStr >= 0x1100) && (*pStr < 0x1200))   // hangul jamo
-            ||  ((*pStr >= 0x1700) && (*pStr < 0x1900))   // many CTL scripts
-            ||  ((*pStr >= 0xFB1D) && (*pStr < 0xFE00))   // middle east presentation
-            ||  ((*pStr >= 0xFE70) && (*pStr < 0xFEFF))   // arabic presentation B
-            ||  (!bIsCJKIdeograph && (*pStr >= 0xFE00) && (*pStr < 0xFE10))   // variation selectors in BMP
-            )
-                break;
-            bIsCJKIdeograph = false;
-        }
-        if( pStr >= pEnd )
-            nLayoutFlags |= SalLayoutFlags::ComplexDisabled;
-    }
 
     if( meTextLanguage ) //TODO: (mnTextLayoutMode & ComplexTextLayoutFlags::SubstituteDigits)
     {
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 597e546..9cc84d0 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -630,7 +630,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
 
     // strikeout text has to be left aligned
     ComplexTextLayoutFlags nOrigTLM = mnTextLayoutMode;
-    mnTextLayoutMode = ComplexTextLayoutFlags::BiDiStrong | ComplexTextLayoutFlags::ComplexDisabled;
+    mnTextLayoutMode = ComplexTextLayoutFlags::BiDiStrong;
     pLayout = ImplLayout( aStrikeoutText, 0, aStrikeoutText.getLength() );
     mnTextLayoutMode = nOrigTLM;
 
commit 15650f602fd7d9ff7030df3359135f0f4992169a
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Thu Dec 8 07:04:27 2016 +0200

    Drop a hack for Type 1, the future is here
    
    The original issue for reference:
    https://bz.apache.org/ooo/show_bug.cgi?id=36691
    
    Change-Id: I3b68c2c9f7cb94445875ef5a005e73dcfe65fa3a

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 1f5b83d..a8833b2 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8621,18 +8621,6 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
                 }
                 else
                     aUnicodes.push_back(rText[pGlyphs[i]->mnCharPos]);
-                // #i36691# hack that is needed because currently the pGlyphs[]
-                // argument is ignored for embeddable fonts and so the layout
-                // engine's glyph work is ignored (i.e. char mirroring)
-                // TODO: a real solution would be to map the layout engine's
-                // glyphid (i.e. FreeType's synthetic glyphid for a Type1 font)
-                // back to unicode and then to embeddable font's encoding
-                if( (getReferenceDevice()->GetLayoutMode() & ComplexTextLayoutFlags::BiDiRtl) != ComplexTextLayoutFlags::Default )
-                {
-                    size_t nI = aUnicodes.size()-1;
-                    for( int n = 0; n < nChars; n++, nI-- )
-                        aUnicodes[nI] = static_cast<sal_Ucs>(GetMirroredChar(aUnicodes[nI]));
-                }
             }
             else
                 aUnicodes.push_back( 0 );


More information about the Libreoffice-commits mailing list