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

Martin Hosken martin_hosken at sil.org
Wed Sep 16 23:10:39 PDT 2015


 external/graphite/StaticLibrary_graphite.mk |    2 +-
 external/graphite/graphite2.win64.patch.1   |   11 +++++++++++
 vcl/inc/graphite_layout.hxx                 |    2 +-
 vcl/source/glyphs/graphite_layout.cxx       |   16 +++++++++-------
 4 files changed, 22 insertions(+), 9 deletions(-)

New commits:
commit 23b9febbd883f9db77ffb0216b050aaabc4c6510
Author: Martin Hosken <martin_hosken at sil.org>
Date:   Thu Sep 17 08:04:48 2015 +0700

    Fix Graphite windows build static
    
    Change-Id: I6feb3805e79f7cae4a8df7efa665fd97c56411c2
    Reviewed-on: https://gerrit.libreoffice.org/18654
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Martin Hosken <martin_hosken at sil.org>

diff --git a/external/graphite/StaticLibrary_graphite.mk b/external/graphite/StaticLibrary_graphite.mk
index 0cfdb8f..ddbf995 100644
--- a/external/graphite/StaticLibrary_graphite.mk
+++ b/external/graphite/StaticLibrary_graphite.mk
@@ -20,7 +20,7 @@ $(eval $(call gb_StaticLibrary_set_include,graphite,\
 
 $(eval $(call gb_StaticLibrary_add_defs,graphite,\
 	-DGRAPHITE2_NTRACING \
-	-DGR2_STATIC \
+	-DGRAPHITE2_STATIC \
 ))
 
 ifeq ($(COM),GCC)
diff --git a/external/graphite/graphite2.win64.patch.1 b/external/graphite/graphite2.win64.patch.1
index 5d409bb..0286126 100644
--- a/external/graphite/graphite2.win64.patch.1
+++ b/external/graphite/graphite2.win64.patch.1
@@ -1,3 +1,14 @@
+diff -ur graphite.org/src/inc/Main.h graphite/src/inc/Main.h
+--- graphite.org/src/inc/Main.h	2015-09-07 20:09:25.572279671 +0700
+--- graphite/src/inc/Main.h	2015-09-07 20:09:25.572279671 +0700
+@@ -25,6 +25,7 @@
+ of the License or (at your option) any later version.
+ */
+ #pragma once
++#pragma warning(disable: 4510 4610)
+ 
+ #include <cstdlib>
+ #include "graphite2/Types.h"
 diff -ur graphite.org/src/inc/json.h graphite/src/inc/json.h
 --- graphite.org/src/inc/json.h	2015-02-03 14:49:24.408101900 +0100
 +++ graphite/src/inc/json.h	2015-02-03 14:50:59.697552200 +0100
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index 1378f88..abb9acf 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -93,7 +93,7 @@ public:
 private:
     const gr_face *         mpFace; // not owned by layout
     gr_font *               mpFont; // not owned by layout
-    int                     mnSegCharOffset; // relative to ImplLayoutArgs::mpStr
+    unsigned int            mnSegCharOffset; // relative to ImplLayoutArgs::mpStr
     long                    mnWidth;
     std::vector<int>        mvChar2BaseGlyph;
     std::vector<int>        mvChar2Glyph;
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 07d19cf..bf38a49 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -148,14 +148,14 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc
     for ( ; baseSlot; baseSlot = nextBaseSlot)
     {
         thisBoundary = nextBoundary;
-        int firstChar = gr_slot_before(baseSlot) + mnSegCharOffset;
+        int firstChar = gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot))) + mnSegCharOffset;
         nextBaseSlot = get_next_base(bRtl ? gr_slot_prev_in_segment(baseSlot) : gr_slot_next_in_segment(baseSlot), bRtl);
         nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : gr_seg_advance_X(pSegment);
         if (firstChar < mnMinCharPos || firstChar >= mnEndCharPos)
             continue;
         // handle reordered clusters. Presumes reordered glyphs have monotonic opposite char index until the cluster base.
-        bool isReordered = (nextBaseSlot && ((bRtl != (gr_slot_before(nextBaseSlot) < firstChar - mnSegCharOffset))
-                                             || gr_slot_before(nextBaseSlot) == firstChar - mnSegCharOffset));
+        bool isReordered = (nextBaseSlot && ((bRtl != (gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) < firstChar - mnSegCharOffset))
+                                             || gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) == firstChar - mnSegCharOffset));
         if (clusterStart >= 0 && !isReordered)      // we hit the base (end) of a reordered cluster
         {
             int clusterEnd = mvGlyphs.size();
@@ -189,7 +189,7 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc
         }
 
         int baseGlyph = mvGlyphs.size();
-        mvCharBreaks[firstChar - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSegment, firstChar - mnSegCharOffset));
+        mvCharBreaks[firstChar - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot)));
         mvChar2BaseGlyph[firstChar - mnMinCharPos] = baseGlyph;
         mvCharDxs[firstChar - mnMinCharPos] = static_cast<int>((bRtl ? thisBoundary : nextBoundary) * fScaling) + mnWidth + nDxOffset;
         mvGlyph2Char[baseGlyph] = firstChar;
@@ -265,7 +265,7 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs,
 {
     assert(gi);
     // assert(gr_slot_before(gi) <= gr_slot_after(gi));
-    int firstChar = gr_slot_before(gi) + mnSegCharOffset;
+    int firstChar = gr_cinfo_base(gr_seg_cinfo(pSeg, gr_slot_before(gi))) + mnSegCharOffset;
     assert(mvGlyphs.size() < mvGlyph2Char.size());
     if (firstChar < mnMinCharPos || firstChar >= mnEndCharPos)
         return nextGlyphOrigin;
@@ -274,7 +274,7 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs,
     {
         mvChar2BaseGlyph[firstChar - mnMinCharPos] = baseGlyph;
         mvCharDxs[firstChar - mnMinCharPos] = mvCharDxs[baseChar - mnMinCharPos];
-        mvCharBreaks[firstChar - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSeg, firstChar - mnSegCharOffset));
+        mvCharBreaks[firstChar - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSeg, gr_slot_before(gi)));
     }
     long glyphId = gr_slot_gid(gi);
     long deltaOffset = 0;
@@ -639,7 +639,8 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
 int GraphiteLayout::ScanFwdForChar(int &findChar, bool fallback) const
 {
     int res = mvChar2Glyph[findChar - mnMinCharPos];
-    if (res == -1)
+    int done = 3;
+    while (res == -1 && --done)
     {
         if (fallback)
         {
@@ -653,6 +654,7 @@ int GraphiteLayout::ScanFwdForChar(int &findChar, bool fallback) const
                 if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
                     return res;
         }
+        fallback = !fallback;
     }
     return res;
 }


More information about the Libreoffice-commits mailing list