8027775: Enhance ICU code
Reviewed-by: srl, bae, mschoene
This commit is contained in:
parent
ba1daa673f
commit
3caa6fdc1a
@ -154,6 +154,7 @@ TTGlyphID ContextualGlyphSubstitutionProcessor2::lookup(le_uint32 offset, LEGlyp
|
||||
TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid);
|
||||
if ((glyphCode >= firstGlyph) && (glyphCode < lastGlyph)) {
|
||||
LEReferenceToArrayOf<LookupValue> valueArray(lookupTable8, success, &lookupTable8->valueArray[0], glyphCount);
|
||||
if (LE_FAILURE(success)) { return newGlyph; }
|
||||
newGlyph = SWAPW(valueArray(glyphCode - firstGlyph, success));
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,8 @@ le_bool ContextualSubstitutionBase::matchGlyphClasses(
|
||||
LEErrorCode &success,
|
||||
le_bool backtrack)
|
||||
{
|
||||
if (LE_FAILURE(success)) { return FALSE; }
|
||||
|
||||
le_int32 direction = 1;
|
||||
le_int32 match = 0;
|
||||
|
||||
@ -255,6 +257,7 @@ le_uint32 ContextualSubstitutionFormat1Subtable::process(const LETableReference
|
||||
le_uint16 matchCount = SWAPW(subRuleTable->glyphCount) - 1;
|
||||
le_uint16 substCount = SWAPW(subRuleTable->substCount);
|
||||
LEReferenceToArrayOf<TTGlyphID> inputGlyphArray(base, success, subRuleTable->inputGlyphArray, matchCount+2);
|
||||
if (LE_FAILURE(success)) { return 0; }
|
||||
if (matchGlyphIDs(inputGlyphArray, matchCount, glyphIterator)) {
|
||||
LEReferenceToArrayOf<SubstitutionLookupRecord>
|
||||
substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) &subRuleTable->inputGlyphArray[matchCount], substCount);
|
||||
@ -315,6 +318,7 @@ le_uint32 ContextualSubstitutionFormat2Subtable::process(const LETableReference
|
||||
|
||||
LEReferenceToArrayOf<le_uint16> classArray(base, success, subClassRuleTable->classArray, matchCount+1);
|
||||
|
||||
if (LE_FAILURE(success)) { return 0; }
|
||||
if (matchGlyphClasses(classArray, matchCount, glyphIterator, classDefinitionTable, success)) {
|
||||
LEReferenceToArrayOf<SubstitutionLookupRecord>
|
||||
substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) &subClassRuleTable->classArray[matchCount], substCount);
|
||||
@ -573,7 +577,7 @@ le_uint32 ChainingContextualSubstitutionFormat2Subtable::process(const LETableRe
|
||||
if (matchGlyphClasses(inputClassArray, inputGlyphCount, glyphIterator, inputClassDefinitionTable, success)) {
|
||||
LEReferenceToArrayOf<SubstitutionLookupRecord>
|
||||
substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) lookaheadClassArray.getAlias(lookaheadGlyphCount + 1, success), substCount);
|
||||
|
||||
if (LE_FAILURE(success)) { return 0; }
|
||||
applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
|
||||
|
||||
return inputGlyphCount + 1;
|
||||
@ -601,9 +605,10 @@ le_uint32 ChainingContextualSubstitutionFormat3Subtable::process(const LETableRe
|
||||
le_uint16 backtrkGlyphCount = SWAPW(backtrackGlyphCount);
|
||||
le_uint16 inputGlyphCount = (le_uint16) SWAPW(backtrackCoverageTableOffsetArray[backtrkGlyphCount]);
|
||||
LEReferenceToArrayOf<Offset> inputCoverageTableOffsetArray(base, success, &backtrackCoverageTableOffsetArray[backtrkGlyphCount + 1], inputGlyphCount+2); // offset
|
||||
if (LE_FAILURE(success)) { return 0; }
|
||||
const le_uint16 lookaheadGlyphCount = (le_uint16) SWAPW(inputCoverageTableOffsetArray[inputGlyphCount]);
|
||||
|
||||
if( LE_FAILURE(success) ) { return 0; }
|
||||
if( LE_FAILURE(success)) { return 0; }
|
||||
LEReferenceToArrayOf<Offset> lookaheadCoverageTableOffsetArray(base, success, inputCoverageTableOffsetArray.getAlias(inputGlyphCount + 1, success), lookaheadGlyphCount+2);
|
||||
|
||||
if( LE_FAILURE(success) ) { return 0; }
|
||||
|
@ -282,6 +282,7 @@ LookupProcessor::LookupProcessor(const LETableReference &baseAddress,
|
||||
|
||||
for (le_uint16 feature = 0; feature < featureCount; feature += 1) {
|
||||
LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount);
|
||||
if (LE_FAILURE(success)) { continue; }
|
||||
le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature,success));
|
||||
|
||||
// don't add the required feature to the list more than once...
|
||||
|
@ -67,6 +67,7 @@ le_int32 MarkToBasePositioningSubtable::process(const LETableReference &base, Gl
|
||||
|
||||
LEPoint markAnchor;
|
||||
LEReferenceTo<MarkArray> markArray(base, success, (const MarkArray *) ((char *) this + SWAPW(markArrayOffset)));
|
||||
if(LE_FAILURE(success)) return 0;
|
||||
le_int32 markClass = markArray->getMarkClass(markArray, markGlyph, markCoverage, fontInstance, markAnchor, success);
|
||||
le_uint16 mcCount = SWAPW(classCount);
|
||||
|
||||
|
@ -79,8 +79,8 @@ le_int8 OpenTypeUtilities::highBit(le_int32 value)
|
||||
|
||||
Offset OpenTypeUtilities::getTagOffset(LETag tag, const LEReferenceToArrayOf<TagAndOffsetRecord> &records, LEErrorCode &success)
|
||||
{
|
||||
const TagAndOffsetRecord *r0 = (const TagAndOffsetRecord*)records.getAlias();
|
||||
if(LE_FAILURE(success)) return 0;
|
||||
const TagAndOffsetRecord *r0 = (const TagAndOffsetRecord*)records.getAlias();
|
||||
|
||||
le_uint32 recordCount = records.getCount();
|
||||
le_uint8 bit = highBit(recordCount);
|
||||
|
@ -73,6 +73,7 @@ void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &s
|
||||
|
||||
if (offset != 0) {
|
||||
LEReferenceToArrayOf<TTGlyphID> glyphArray(subtableHeader, success, offset, LE_UNBOUNDED_ARRAY);
|
||||
if (LE_FAILURE(success)) { continue; }
|
||||
TTGlyphID newGlyph = SWAPW(glyphArray(LE_GET_GLYPH(thisGlyph) - firstGlyph, success));
|
||||
glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ void StateTableProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &suc
|
||||
|
||||
LEReferenceToArrayOf<EntryTableIndex> stateArray(stHeader, success, currentState, LE_UNBOUNDED_ARRAY);
|
||||
EntryTableIndex entryTableIndex = stateArray.getObject((le_uint8)classCode, success);
|
||||
if (LE_FAILURE(success)) { break; }
|
||||
LE_STATE_PATIENCE_CURR(le_int32, currGlyph);
|
||||
currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex);
|
||||
LE_STATE_PATIENCE_INCR(currGlyph);
|
||||
|
Loading…
x
Reference in New Issue
Block a user