Fix Graphite windows build static

Change-Id: I6feb3805e79f7cae4a8df7efa665fd97c56411c2
Reviewed-on: https://gerrit.libreoffice.org/18654
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hosken@sil.org>
This commit is contained in:
Martin Hosken
2015-09-17 08:04:48 +07:00
parent f2b93f2e31
commit 23b9febbd8
4 changed files with 22 additions and 9 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}