bool Validate_indexSubTable_format1(Validator v, indexSubTable1 ist1, indexSubTableArray ista, string sID, OTFontVal fontOwner) { bool bOk = true; Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT"); // header has already been validated // validate the array of offsets uint nEBDTLength = EBDTTable.GetLength(); int nArrSize = ista.lastGlyphIndex - ista.firstGlyphIndex + 1; for (ushort i = 0; i < nArrSize; i++) { uint offsetImage = ist1.GetOffset(i) + ist1.header.imageDataOffset; if (offsetImage > nEBDTLength) { string sDetails = "invalid offset: " + sID + ", offset[" + i + "] = " + offsetImage + ", EBDT length = " + EBDTTable.GetLength(); v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails); bOk = false; } } return(bOk); }
public indexSubTable GetIndexSubTable(indexSubTableArray ista) { indexSubTable ist = null; uint offset = indexSubTableArrayOffset + ista.additionalOffsetToIndexSubtable; if (offset + (uint)indexSubHeader.FieldOffsets.indexFormat + 2 <= m_bufTable.GetLength()) { ushort indexFormat = m_bufTable.GetUshort(offset + (uint)indexSubHeader.FieldOffsets.indexFormat); switch(indexFormat) { case 1: { indexSubTable1 ist1 = new indexSubTable1(offset, m_bufTable, ista); ist = ist1; break; } case 2: { indexSubTable2 ist2 = new indexSubTable2(offset, m_bufTable, ista); ist = ist2; ist2.bigMetrics = new Table_EBDT.bigGlyphMetrics(); ist2.imageSize = m_bufTable.GetUint(offset + indexSubTable.headerLength); ist2.bigMetrics.height = m_bufTable.GetByte (offset + indexSubTable.headerLength + 4); ist2.bigMetrics.width = m_bufTable.GetByte (offset + indexSubTable.headerLength + 5); ist2.bigMetrics.horiBearingX = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 6); ist2.bigMetrics.horiBearingY = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 7); ist2.bigMetrics.horiAdvance = m_bufTable.GetByte (offset + indexSubTable.headerLength + 8); ist2.bigMetrics.vertBearingX = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 9); ist2.bigMetrics.vertBearingY = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 10); ist2.bigMetrics.vertAdvance = m_bufTable.GetByte (offset + indexSubTable.headerLength + 11); break; } case 3: { indexSubTable3 ist3 = new indexSubTable3(offset, m_bufTable, ista); ist = ist3; break; } case 4: { indexSubTable4 ist4 = new indexSubTable4(offset, m_bufTable, ista); ist = ist4; ist4.numGlyphs = m_bufTable.GetUint(offset + indexSubTable.headerLength); break; } case 5: { indexSubTable5 ist5 = new indexSubTable5(offset, m_bufTable, ista); ist = ist5; ist5.bigMetrics = new Table_EBDT.bigGlyphMetrics(); ist5.imageSize = m_bufTable.GetUint(offset + indexSubTable.headerLength); ist5.bigMetrics.height = m_bufTable.GetByte (offset + indexSubTable.headerLength + 4); ist5.bigMetrics.width = m_bufTable.GetByte (offset + indexSubTable.headerLength + 5); ist5.bigMetrics.horiBearingX = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 6); ist5.bigMetrics.horiBearingY = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 7); ist5.bigMetrics.horiAdvance = m_bufTable.GetByte (offset + indexSubTable.headerLength + 8); ist5.bigMetrics.vertBearingX = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 9); ist5.bigMetrics.vertBearingY = m_bufTable.GetSbyte(offset + indexSubTable.headerLength + 10); ist5.bigMetrics.vertAdvance = m_bufTable.GetByte (offset + indexSubTable.headerLength + 11); ist5.numGlyphs = m_bufTable.GetUint(offset + indexSubTable.headerLength + 12); break; } } } return ist; }
bool Validate_indexSubTable_format1(Validator v, indexSubTable1 ist1, indexSubTableArray ista, string sID, OTFontVal fontOwner) { bool bOk = true; Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT"); // header has already been validated // validate the array of offsets uint nEBDTLength = EBDTTable.GetLength(); int nArrSize = ista.lastGlyphIndex - ista.firstGlyphIndex + 1; for (ushort i=0; i<nArrSize; i++) { uint offsetImage = ist1.GetOffset(i) + ist1.header.imageDataOffset; if (offsetImage > nEBDTLength) { string sDetails = "invalid offset: " + sID + ", offset[" + i + "] = " + offsetImage + ", EBDT length = " + EBDTTable.GetLength(); v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails); bOk = false; } } return bOk; }