summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdownload.lst2
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx23
2 files changed, 20 insertions, 5 deletions
diff --git a/download.lst b/download.lst
index b1ebb89538e0..d88d76a788bc 100755
--- a/download.lst
+++ b/download.lst
@@ -52,7 +52,7 @@ export FREEHAND_TARBALL := libfreehand-0.1.1.tar.bz2
export FREETYPE_TARBALL := dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
export GLM_TARBALL := bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
-export GRAPHITE_TARBALL := 7cda6fc6bc197b216777b15ce52c38a8-graphite2-1.3.3.tgz
+export GRAPHITE_TARBALL := 5c0c9ac0996fbb4a0e17780ff5441959-graphite2-minimal-1.3.4.tgz
export HARFBUZZ_MD5SUM := 0e27e531f4c4acff601ebff0957755c2
export HARFBUZZ_TARBALL := harfbuzz-0.9.40.tar.bz2
export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 4a723a35287a..eaff9713d316 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -118,6 +118,13 @@ const gr_slot *get_next_base(const gr_slot *slot, bool bRtl)
return slot;
}
+bool isWhite(sal_Unicode nChar)
+{
+ if (nChar <= 0x0020 || nChar == 0x00A0 || (nChar >= 0x2000 && nChar <= 0x200F) || nChar == 0x3000)
+ return true;
+ return false;
+}
+
// The Graphite glyph stream is really a sequence of glyph attachment trees
// each rooted at a non-attached base glyph. fill_from walks the glyph stream,
// finds each non-attached base glyph and calls append to record them as a
@@ -135,6 +142,8 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc
int clusterStart = -1;
int clusterFirstChar = -1;
const gr_slot *nextBaseSlot;
+ const sal_Unicode *pStr = rArgs.mrStr.getStr();
+ int firstChar;
if (!nGlyphs || lastCharPos - mnSegCharOffset == 0) return;
const gr_slot* baseSlot = bRtl ? gr_seg_last_slot(pSegment) : gr_seg_first_slot(pSegment);
@@ -142,19 +151,24 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc
while (baseSlot && gr_slot_attached_to(baseSlot) != NULL && !gr_slot_can_insert_before(baseSlot))
baseSlot = bRtl ? gr_slot_prev_in_segment(baseSlot) : gr_slot_next_in_segment(baseSlot);
assert(baseSlot);
+ int nextChar = gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot))) + mnSegCharOffset;
+ float thisBoundary = 0.;
float nextBoundary = gr_slot_origin_X(baseSlot);
// now loop over bases
for ( ; baseSlot; baseSlot = nextBaseSlot)
{
- float thisBoundary = nextBoundary;
- int firstChar = gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot))) + mnSegCharOffset;
+ firstChar = nextChar;
+ thisBoundary = nextBoundary;
nextBaseSlot = get_next_base(bRtl ? gr_slot_prev_in_segment(baseSlot) : gr_slot_next_in_segment(baseSlot), bRtl);
+ nextChar = nextBaseSlot ? gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) + mnSegCharOffset : -1;
nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : gr_seg_advance_X(pSegment);
+
if (firstChar < mnMinCharPos || firstChar >= mnEndCharPos)
{
// handle clipping of diacritic from base
nextBaseSlot = bRtl ? gr_slot_prev_in_segment(baseSlot) : gr_slot_next_in_segment(baseSlot);
nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : gr_seg_advance_X(pSegment);
+ nextChar = nextBaseSlot ? gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) + mnSegCharOffset : -1;
continue;
}
// handle reordered clusters. Presumes reordered glyphs have monotonic opposite char index until the cluster base.
@@ -204,7 +218,8 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc
mvGlyph2Char[baseGlyph] = firstChar;
append(pSegment, rArgs, baseSlot, thisBoundary, nextBoundary, fScaling, nDxOffset, true, firstChar, baseGlyph, bRtl);
if (thisBoundary < fMinX) fMinX = thisBoundary;
- if (nextBoundary > fMaxX) fMaxX = nextBoundary;
+ if (nextBoundary > fMaxX && (nextChar < mnMinCharPos || nextChar >= mnEndCharPos || !isWhite(pStr[nextChar]) || fMaxX <= 0.0f))
+ fMaxX = nextBoundary;
}
long nXOffset = round_to_long(fMinX * fScaling);
@@ -433,7 +448,7 @@ bool GraphiteLayout::LayoutText(ImplLayoutArgs & rArgs)
fprintf(grLog(),"Gr::LayoutText %d-%d, context %d-%d, len %d, numchars %" SAL_PRI_SIZET "u, rtl %d scaling %f:",
rArgs.mnMinCharPos, rArgs.mnEndCharPos,
nBidiMinRunPos, nBidiEndRunPos,
- mnLength, numchars, bRightToLeft, mfScaling);
+ nLength, numchars, bRightToLeft, mfScaling);
for (int i = mnSegCharOffset; i < nBidiEndRunPos; ++i)
fprintf(grLog(), " %04X", rArgs.mrStr[i]);
fprintf(grLog(), "\n");