8005007: Better glyph processing
Reviewed-by: srl, mschoene, bae
This commit is contained in:
parent
f4069d1374
commit
7d8a89c6c1
@ -367,6 +367,9 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
|
|||||||
validate(index);
|
validate(index);
|
||||||
float[] charinfo = getCharinfo();
|
float[] charinfo = getCharinfo();
|
||||||
index = l2v(index) * numvals;
|
index = l2v(index) * numvals;
|
||||||
|
if ((index+vish) >= charinfo.length) {
|
||||||
|
return new Rectangle2D.Float();
|
||||||
|
}
|
||||||
return new Rectangle2D.Float(
|
return new Rectangle2D.Float(
|
||||||
charinfo[index + visx],
|
charinfo[index + visx],
|
||||||
charinfo[index + visy],
|
charinfo[index + visy],
|
||||||
@ -456,6 +459,10 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
|
|||||||
int length = source.getLength();
|
int length = source.getLength();
|
||||||
--start;
|
--start;
|
||||||
while (width >= 0 && ++start < length) {
|
while (width >= 0 && ++start < length) {
|
||||||
|
int cidx = l2v(start) * numvals + advx;
|
||||||
|
if (cidx >= charinfo.length) {
|
||||||
|
break; // layout bailed for some reason
|
||||||
|
}
|
||||||
float adv = charinfo[l2v(start) * numvals + advx];
|
float adv = charinfo[l2v(start) * numvals + advx];
|
||||||
width -= adv;
|
width -= adv;
|
||||||
}
|
}
|
||||||
@ -469,7 +476,11 @@ class ExtendedTextSourceLabel extends ExtendedTextLabel implements Decoration.La
|
|||||||
float[] charinfo = getCharinfo();
|
float[] charinfo = getCharinfo();
|
||||||
--start;
|
--start;
|
||||||
while (++start < limit) {
|
while (++start < limit) {
|
||||||
a += charinfo[l2v(start) * numvals + advx];
|
int cidx = l2v(start) * numvals + advx;
|
||||||
|
if (cidx >= charinfo.length) {
|
||||||
|
break; // layout bailed for some reason
|
||||||
|
}
|
||||||
|
a += charinfo[cidx];
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
|
@ -584,7 +584,7 @@ le_int32 LEGlyphStorage::applyInsertions()
|
|||||||
{
|
{
|
||||||
le_int32 growAmount = fInsertionList->getGrowAmount();
|
le_int32 growAmount = fInsertionList->getGrowAmount();
|
||||||
|
|
||||||
if (growAmount == 0) {
|
if (growAmount <= 0) {
|
||||||
return fGlyphCount;
|
return fGlyphCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +613,9 @@ le_int32 LEGlyphStorage::applyInsertions()
|
|||||||
fAuxData = (le_uint32 *)newAuxData;
|
fAuxData = (le_uint32 *)newAuxData;
|
||||||
}
|
}
|
||||||
|
|
||||||
fSrcIndex = fGlyphCount - 1;
|
if (fGlyphCount > 0) {
|
||||||
|
fSrcIndex = fGlyphCount - 1;
|
||||||
|
}
|
||||||
fDestIndex = newGlyphCount - 1;
|
fDestIndex = newGlyphCount - 1;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -653,6 +655,10 @@ le_bool LEGlyphStorage::applyInsertion(le_int32 atPosition, le_int32 count, LEGl
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (atPosition < 0 || fSrcIndex < 0 || fDestIndex < 0) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (fAuxData != NULL) {
|
if (fAuxData != NULL) {
|
||||||
le_int32 src = fSrcIndex, dest = fDestIndex;
|
le_int32 src = fSrcIndex, dest = fDestIndex;
|
||||||
|
|
||||||
@ -665,7 +671,7 @@ le_bool LEGlyphStorage::applyInsertion(le_int32 atPosition, le_int32 count, LEGl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fSrcIndex > atPosition) {
|
while (fSrcIndex > atPosition && fSrcIndex >= 0 && fDestIndex >= 0) {
|
||||||
fGlyphs[fDestIndex] = fGlyphs[fSrcIndex];
|
fGlyphs[fDestIndex] = fGlyphs[fSrcIndex];
|
||||||
fCharIndices[fDestIndex] = fCharIndices[fSrcIndex];
|
fCharIndices[fDestIndex] = fCharIndices[fSrcIndex];
|
||||||
|
|
||||||
@ -673,7 +679,7 @@ le_bool LEGlyphStorage::applyInsertion(le_int32 atPosition, le_int32 count, LEGl
|
|||||||
fSrcIndex -= 1;
|
fSrcIndex -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (le_int32 i = count - 1; i >= 0; i -= 1) {
|
for (le_int32 i = count - 1; i >= 0 && fDestIndex >= 0; i -= 1) {
|
||||||
fGlyphs[fDestIndex] = newGlyphs[i];
|
fGlyphs[fDestIndex] = newGlyphs[i];
|
||||||
fCharIndices[fDestIndex] = fCharIndices[atPosition];
|
fCharIndices[fDestIndex] = fCharIndices[atPosition];
|
||||||
|
|
||||||
@ -682,7 +688,7 @@ le_bool LEGlyphStorage::applyInsertion(le_int32 atPosition, le_int32 count, LEGl
|
|||||||
|
|
||||||
// the source glyph we're pointing at
|
// the source glyph we're pointing at
|
||||||
// just got replaced by the insertion
|
// just got replaced by the insertion
|
||||||
fSrcIndex -= 1;
|
fSrcIndex -= 1;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ le_uint32 LookupProcessor::applyLookupTable(const LEReferenceTo<LookupTable> &lo
|
|||||||
|
|
||||||
delta = applySubtable(lookupSubtable, lookupType, glyphIterator, fontInstance, success);
|
delta = applySubtable(lookupSubtable, lookupType, glyphIterator, fontInstance, success);
|
||||||
|
|
||||||
if (delta > 0 && LE_FAILURE(success)) {
|
if (delta > 0 || LE_FAILURE(success)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user