bool Validate_indexSubTable_format2(Validator v, indexSubTable2 ist2, indexSubTableArray ista, string sID, OTFontVal fontOwner) { bool bOk = true; Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT"); // header has already been validated // validate the image size uint nGlyphsInRange = (uint)ista.lastGlyphIndex - ista.firstGlyphIndex + 1; if (nGlyphsInRange * ist2.imageSize > EBDTTable.GetLength()) { string sDetails = "images extend past end of EBDT table: " + sID + ", imageSize = " + ist2.imageSize + ", EBDT length = " + EBDTTable.GetLength(); v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails); bOk = false; } // validate the bigGlyphMetrics val_EBDT.bigGlyphMetrics_val bgm = val_EBDT.bigGlyphMetrics_val.CreateFromBigGlyphMetrics(ist2.bigMetrics); bgm.Validate(v, sID, this); return(bOk); }
bool Validate_indexSubTable_format5(Validator v, indexSubTable5 ist5, indexSubTableArray ista, string sID, OTFontVal fontOwner) { bool bOk = true; Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT"); // header has already been validated // validate the image size if (ist5.numGlyphs * ist5.imageSize > EBDTTable.GetLength()) { string sDetails = "images extend past end of EBDT table: " + sID + ", imageSize = " + ist5.imageSize + ", EBDT length = " + EBDTTable.GetLength(); v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails); bOk = false; } // validate the bigGlyphMetrics val_EBDT.bigGlyphMetrics_val bgm = val_EBDT.bigGlyphMetrics_val.CreateFromBigGlyphMetrics(ist5.bigMetrics); bgm.Validate(v, sID, this); // validate numGlyphs uint nGlyphsInRange = (uint)ista.lastGlyphIndex - ista.firstGlyphIndex + 1; if (ist5.numGlyphs > nGlyphsInRange) { string sDetails = "numGlyphs is invalid: " + sID + ", numGlyphs = " + ist5.numGlyphs + ", indexSubTableArray.firstGlyphIndex = " + ista.firstGlyphIndex + ", indexSubTableArray.lastGlyphIndex = " + ista.lastGlyphIndex; v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails); bOk = false; } // validate glyphCodeArray for (ushort i = 0; i < ist5.numGlyphs; i++) { ushort idGlyph = ist5.GetGlyphCode(i); if (idGlyph < ista.firstGlyphIndex || idGlyph > ista.lastGlyphIndex) { string sDetails = "invalid glyph id: " + sID + ", glyphCodeArray[" + i + "] = " + idGlyph + ", indexSubTableArray.firstGlyphIndex = " + ista.firstGlyphIndex + ", indexSubTableArray.lastGlyphIndex = " + ista.lastGlyphIndex; v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails); bOk = false; } } return(bOk); }