vcl/generic/glyphs/gcach_layout.cxx |   20 +++++++++++++++++++-
 vcl/source/gdi/sallayout.cxx        |    2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit c72955bcb196574f7bc682e7aa301264a8a54635
Author: Khaled Hosny <khaledho...@eglug.org>
Date:   Sat May 25 11:12:56 2013 +0200

    Revert "Fix improper glyph positioning with old fonts"
    
    This reverts commit cef3f3aac2f7a372e796deac4ee3e8155c5eb697.
    
    The previous commit addressed the real issue.
    
    Change-Id: I802e5f19e4a4991c316135f3984a1b9a6533a104

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 31b01b9..bd7a326 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1098,7 +1098,7 @@ void GenericSalLayout::ApplyDXArray( ImplLayoutArgs& 
rArgs )
                 if( m_GlyphItems[j].IsClusterStart() )
                     break;
                 if( !m_GlyphItems[j].IsDiacritic() ) // #i99367# ignore 
diacritics
-                    nOldClusterWidth += m_GlyphItems[j].mnNewWidth;
+                    nOldClusterWidth += m_GlyphItems[j].mnNewWidth - 
m_GlyphItems[j].mnXOffset;
                 nNewClusterWidth += pNewGlyphWidths[j];
             }
             const int nDiff = nNewClusterWidth - nOldClusterWidth;
commit 90c6531caa3ec530ef6e9bf1081d289b16fe53ba
Author: Khaled Hosny <khaledho...@eglug.org>
Date:   Sat May 25 02:24:36 2013 +0200

    A hack to fix mark placement in old fonts
    
    We need a way to recognize non spacing marks in fonts lacking GDEF table
    (like old Arabic fonts), so I just check for zero advance width and hope
    nothing elsewhere will break...
    
    Change-Id: I6fa848e97ba24d71fc9a381ae439e0fb98e50419

diff --git a/vcl/generic/glyphs/gcach_layout.cxx 
b/vcl/generic/glyphs/gcach_layout.cxx
index 6ac7fd4..4fd4cf4 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -428,7 +428,25 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, 
ImplLayoutArgs& rArgs)
             if (bInCluster)
                 nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
 
-            if (hb_ot_layout_get_glyph_class(mpHbFace, nGlyphIndex) == 
HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+            bool bDiacritic = false;
+            if (hb_ot_layout_has_glyph_classes(mpHbFace))
+            {
+                // the font has GDEF table
+                if (hb_ot_layout_get_glyph_class(mpHbFace, nGlyphIndex) == 
HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+                    bDiacritic = true;
+            }
+            else
+            {
+                // the font lacks GDEF table
+                // HACK: if the resolved glyph advance is zero assume it is a
+                // combining mark.  The whole IS_DIACRITIC concept is a hack to
+                // fix the other hacks we use to second-guess glyph advances in
+                // ApplyDXArray and the likes and it needs to die
+                if (pHbPositions[i].x_advance == 0)
+                    bDiacritic = true;
+            }
+
+            if (bDiacritic)
                 nGlyphFlags |= GlyphItem::IS_DIACRITIC;
 
             int32_t nXOffset =  pHbPositions[i].x_offset >> 6;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to