Rebased ref, commits from common ancestor:
commit 59536efb00a6b3e895a760349d5c49bcf451c038
Author: Akash Jain <akash...@gmail.com>
Date:   Fri Aug 26 00:52:50 2016 +0530

    GSoC: Fix Kashida justification in CommonSalLayout
    
    Change-Id: I2d7e9b0c6a5ad2210854a49729a72c811e1ebfc5

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index f39d816..9b623eb 100755
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -242,7 +242,22 @@ void CommonSalLayout::AdjustLayout(ImplLayoutArgs& rArgs)
     && !(rArgs.mnFlags & SalLayoutFlags::Vertical) )
         if( (rArgs.mpDXArray != nullptr) || (rArgs.mnLayoutWidth != 0) )
             ApplyAsianKerning(rArgs.mrStr);
-//XXX Kashida
+
+    hb_font_t* pHBFont = hb_font_create(mpHBFace);
+    hb_ot_font_set_funcs(pHBFont);
+    hb_codepoint_t nKashidaCodePoint = 0x0640;
+    hb_codepoint_t nKashidaGlyphIndex;
+    if((rArgs.mnFlags & SalLayoutFlags::KashidaJustification) && 
rArgs.mpDXArray)
+     {
+        if(hb_font_get_glyph(pHBFont, nKashidaCodePoint, 0, 
&nKashidaGlyphIndex))
+        {
+            if(nKashidaGlyphIndex)
+            {
+                KashidaJustify(nKashidaGlyphIndex, 
hb_font_get_glyph_h_advance(pHBFont, nKashidaGlyphIndex) >> 6);
+            }
+        }
+    }
+    hb_font_destroy(pHBFont);
 }
 
 void CommonSalLayout::DrawText( SalGraphics& rSalGraphics ) const
@@ -265,6 +280,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
     hb_font_set_scale(pHBFont, (uint64_t)(maFontSelData.mnWidth? 
maFontSelData.mnWidth:maFontSelData.mnHeight) << 6
                              , (uint64_t)maFontSelData.mnHeight << 6);
     hb_ot_font_set_funcs(pHBFont);
+    hb_script_t aHbScript = HB_SCRIPT_INVALID;
 
     int nGlyphCapacity = 2 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos);
     Reserve(nGlyphCapacity);
@@ -326,7 +342,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
             int nMinRunPos = it->mnMin;
             int nEndRunPos = it->mnEnd;
             int nRunLen = nEndRunPos - nMinRunPos;
-            hb_script_t aHbScript = it->maScript;
+            aHbScript = it->maScript;
             // hb_language_from_string() accept ISO639-3 language tag except 
for Chinese.
             LanguageTag &rTag = rArgs.maLanguageTag;
             OString sLanguage = OUStringToOString( 
MsLangId::isChinese(rTag.getLanguageType()) ? 
rTag.getBcp47():rTag.getLanguage() , RTL_TEXTENCODING_UTF8 );
@@ -449,10 +465,9 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
     SortGlyphItems();
 
-    /* XXX seems to be broken
     if((rArgs.mpDXArray || rArgs.mnLayoutWidth)
-    && ((maHbScript == HB_SCRIPT_ARABIC) || (maHbScript == HB_SCRIPT_SYRIAC)))
+    && ((aHbScript == HB_SCRIPT_ARABIC) || (aHbScript == HB_SCRIPT_SYRIAC)))
         rArgs.mnFlags |= SalLayoutFlags::KashidaJustification;
-    */
+
     return true;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to