public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GPOS)table).ValidateNoOverlap(m_offsetPairPos, CalcLength(), v, sIdentity, table.GetTag()); // check the coverage offset if (m_offsetPairPos + Coverage > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GPOS_E_Offset_PastEOT, table.m_tag, sIdentity + ", Coverage offset"); bRet = false; } // check the ValueFormat1 reserved bits if ((ValueFormat1 & 0xff00) != 0) { v.Error(T.T_NULL, E.GPOS_E_ValueFormatReservedBits, table.m_tag, sIdentity + ", ValueFormat1"); bRet = false; } // check the ValueFormat2 reserved bits if ((ValueFormat2 & 0xff00) != 0) { v.Error(T.T_NULL, E.GPOS_E_ValueFormatReservedBits, table.m_tag, sIdentity + ", ValueFormat2"); bRet = false; } // check the ClassDef1 offset if (m_offsetPairPos + ClassDef1Offset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GPOS_E_Offset_PastEOT, table.m_tag, sIdentity + ", ClassDef1"); bRet = false; } // check the ClassDef2 offset if (m_offsetPairPos + ClassDef2Offset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GPOS_E_Offset_PastEOT, table.m_tag, sIdentity + ", ClassDef2"); bRet = false; } // check that the Class1Record array doesn't extend past the end of the table uint sizeofClass2 = ValueRecord.SizeOfValueRecord(ValueFormat1) + ValueRecord.SizeOfValueRecord(ValueFormat2); if (m_offsetPairPos + (uint)FieldOffsets.Class1Records + Class1Count*Class2Count*sizeofClass2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GPOS_E_Array_pastEOT, table.m_tag, sIdentity + ", Class1Record"); bRet = false; } // validate the coverage table CoverageTable_val ct = GetCoverageTable_val(); bRet &= ct.Validate(v, sIdentity + ", Coverage", table); // validate the ClassDef tables ClassDefTable_val cdt1 = GetClassDef1Table_val(); bRet &= cdt1.Validate(v, sIdentity + ", ClassDef1", table); ClassDefTable_val cdt2 = GetClassDef2Table_val(); bRet &= cdt2.Validate(v, sIdentity + ", ClassDef2", table); // validate the Class1 records for (uint i=0; i<Class1Count; i++) { Class1Record_val c1r = GetClass1Record_val(i); c1r.Validate(v, sIdentity + ", Class1Record[" + i + "]", table); } if (bRet) { v.Pass(T.T_NULL, P.GPOS_P_PairPos, table.m_tag, sIdentity); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetLigature, CalcLength(), v, sIdentity, table.GetTag()); // check the component array length if (m_offsetLigature + (uint)FieldOffsets.ComponentGlyphIDs + (CompCount-1)*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", Component array"); bRet = false; } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetContextSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the coverage offset if (m_offsetContextSubst + CoverageOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", Coverage offset"); bRet = false; } // check the coverage table CoverageTable_val ct = GetCoverageTable_val(); bRet &= ct.Validate(v, sIdentity + ", Coverage", table); // check the ClassDef offset if (m_offsetContextSubst + ClassDefOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", ClassDef offset"); bRet = false; } // check the ClassDef table ClassDefTable_val cdt = GetClassDefTable_val(); bRet &= cdt.Validate(v, sIdentity + ", ClassDef", table); // check the SubClassSet array length if (m_offsetContextSubst + (uint)FieldOffsets.SubClassSetOffsets + SubClassSetCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", SubClassSet array"); bRet = false; } // check each SubClassSet offset for (uint i=0; i<SubClassSetCount; i++) { if (m_offsetContextSubst + GetSubClassSetOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", SubClassSet[" + i + "]"); bRet = false; } } // check each SubClassSet table for (uint i=0; i<SubClassSetCount; i++) { if (GetSubClassSetOffset(i) != 0) { SubClassSet_val scs = GetSubClassSetTable_val(i); if (scs != null) { bRet &= scs.Validate(v, sIdentity + ", SubClassSet[" + i + "]", table); } } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; sIdentity += "(ReverseChainSubst)"; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetReverseChainSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the SubstFormat if (SubstFormat != 1) { v.Error(T.T_NULL, E.GSUB_E_SubtableFormat, table.m_tag, sIdentity + ", SubstFormat = " + SubstFormat); bRet = false; } // check the coverage offset if (m_offsetReverseChainSubst + CoverageOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", Coverage offset"); bRet = false; } // check the coverage table CoverageTable_val ct = GetCoverageTable_val(); bRet &= ct.Validate(v, sIdentity + ", Coverage table", table); // check the BacktrackCoverage array length uint offset = m_offsetReverseChainSubst + (uint)FieldOffsets.BacktrackCoverageOffsets; if (offset + BacktrackGlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", BacktrackCoverage array"); bRet = false; } // check each BacktrackCoverage offset for (uint i=0; i<BacktrackGlyphCount; i++) { if (m_offsetReverseChainSubst + GetBacktrackCoverageOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", BacktrackCoverage[" + i + "]"); bRet = false; } } // check each BacktrackCoverage table for (uint i=0; i<BacktrackGlyphCount; i++) { CoverageTable_val bct = GetBacktrackCoverageTable_val(i); bRet &= bct.Validate(v, sIdentity + ", BacktrackCoverage[" + i + "]", table); } // check the LookaheadCoverage array length offset = m_offsetReverseChainSubst + (uint)FieldOffsets.BacktrackCoverageOffsets + (uint)BacktrackGlyphCount*2 + 2; if (offset + LookaheadGlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", LookaheadCoverage array"); bRet = false; } // check each LookaheadCoverage offset for (uint i=0; i<LookaheadGlyphCount; i++) { if (m_offsetReverseChainSubst + GetLookaheadCoverageOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", LookaheadCoverage[" + i + "]"); bRet = false; } } // check each LookaheadCoverage table for (uint i=0; i<LookaheadGlyphCount; i++) { CoverageTable_val lct = GetLookaheadCoverageTable_val(i); bRet &= lct.Validate(v, sIdentity + ", LookaheadCoverage[" + i + "]", table); } // check the SubstituteGlyphIDs array length offset = m_offsetReverseChainSubst + (uint)FieldOffsets.BacktrackCoverageOffsets + (uint)BacktrackGlyphCount*2 + 2 + (uint)LookaheadGlyphCount*2 + 2; if (offset + SubstituteGlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", Substitue Glyph ID array"); bRet = false; } if (bRet) { v.Pass(T.T_NULL, P.GSUB_P_ReverseChainContextSubst, table.m_tag, sIdentity); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetAlternateSet, CalcLength(), v, sIdentity, table.GetTag()); // check the alternate array length if (m_offsetAlternateSet + (uint)FieldOffsets.AlternateGlyphIDs + GlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", Alternate array"); bRet = false; } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetChainContextSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the coverage offset if (m_offsetChainContextSubst + CoverageOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", Coverage offset"); bRet = false; } // check the coverage table CoverageTable_val ct = GetCoverageTable_val(); bRet &= ct.Validate(v, sIdentity + ", Coverage table", table); // check the ChainSubRuleSet array length if (m_offsetChainContextSubst + (uint)FieldOffsets.ChainSubRuleSetOffsets + ChainSubRuleSetCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", ChainSubRuleSet array"); bRet = false; } // check each ChainSubRuleSet offset for (uint i=0; i<ChainSubRuleSetCount; i++) { if (m_offsetChainContextSubst + GetChainSubRuleSetOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", ChainSubRuleSet[" + i + "]"); bRet = false; } } // check each ChainSubRuleSet table for (uint i=0; i<ChainSubRuleSetCount; i++) { ChainSubRuleSet_val csrs = GetChainSubRuleSetTable_val(i); bRet &= csrs.Validate(v, sIdentity + ", ChainSubRuleSet[" + i + "]", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetChainContextSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the BacktrackCoverage array length uint offset = m_offsetChainContextSubst + (uint)FieldOffsets.BacktrackCoverageOffsets; if (offset + BacktrackGlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", BacktrackCoverage array"); bRet = false; } // check each BacktrackCoverage offset for (uint i=0; i<BacktrackGlyphCount; i++) { if (m_offsetChainContextSubst + GetBacktrackCoverageOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", BacktrackCoverage[" + i + "]"); bRet = false; } } // check each BacktrackCoverage table for (uint i=0; i<BacktrackGlyphCount; i++) { CoverageTable_val ct = GetBacktrackCoverageTable_val(i); ct.Validate(v, sIdentity + ", BacktrackCoverage[" + i + "]", table); } // check the InputCoverage array length offset = m_offsetChainContextSubst + (uint)FieldOffsets.BacktrackCoverageOffsets + (uint)BacktrackGlyphCount*2 + 2; if (offset + InputGlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", InputCoverage array"); bRet = false; } // check each InputCoverage offset for (uint i=0; i<InputGlyphCount; i++) { if (m_offsetChainContextSubst + GetInputCoverageOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", InputCoverage[" + i + "]"); bRet = false; } } // check each InputCoverage table for (uint i=0; i<InputGlyphCount; i++) { CoverageTable_val ct = GetInputCoverageTable_val(i); ct.Validate(v, sIdentity + ", InputCoverage[" + i + "]", table); } // check the LookaheadCoverage array length offset = m_offsetChainContextSubst + (uint)FieldOffsets.BacktrackCoverageOffsets + (uint)BacktrackGlyphCount*2 + 2 + (uint)InputGlyphCount*2 + 2; if (offset + LookaheadGlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", LookaheadCoverage array"); bRet = false; } // check each LookaheadCoverage offset for (uint i=0; i<LookaheadGlyphCount; i++) { if (m_offsetChainContextSubst + GetLookaheadCoverageOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", LookaheadCoverage[" + i + "]"); bRet = false; } } // check each LookaheadCoverage table for (uint i=0; i<LookaheadGlyphCount; i++) { CoverageTable_val ct = GetLookaheadCoverageTable_val(i); ct.Validate(v, sIdentity + ", LookaheadCoverage[" + i + "]", table); } // check the SubstLookupRecord array length offset = m_offsetChainContextSubst + (uint)FieldOffsets.BacktrackCoverageOffsets + (uint)BacktrackGlyphCount*2 + 2 + (uint)InputGlyphCount*2 + 2 + (uint)LookaheadGlyphCount*2 + 2; if (offset + SubstCount*4 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", SubstLookupRecord array"); bRet = false; } // check each SubstLookupRecord for (uint i=0; i<SubstCount; i++) { SubstLookupRecord slr = GetSubstLookupRecord(i); if (slr.SequenceIndex > InputGlyphCount) { string sValues = ", slr.SequenceIndex = " + slr.SequenceIndex + ", slr.LookupListIndex = " + slr.LookupListIndex + ", InputGlyphCount = " + InputGlyphCount; v.Error(T.T_NULL, E.GSUB_E_SubstLookupRecord_SequenceIndex, table.m_tag, sIdentity + ", SubstLookupRecord[" + i + "]" + sValues); bRet = false; } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetMinMaxTable, CalcLength(), v, sIdentity, table.GetTag()); // check the MinCoordOffset if (MinCoordOffset == 0) { v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MinCO_0, table.m_tag, sIdentity); } else if (MinCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_MinMaxTable_MinCO, table.m_tag, sIdentity); bRet = false; } else { v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MinCO, table.m_tag, sIdentity); } // check the MaxCoordOffset if (MaxCoordOffset == 0) { v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MaxCO_0, table.m_tag, sIdentity); } else if (MaxCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_MinMaxTable_MaxCO, table.m_tag, sIdentity); bRet = false; } else { v.Pass(T.T_NULL, P.BASE_P_MinMaxTable_MaxCO, table.m_tag, sIdentity); } // check the FeatMinMaxRecords bool bFeatMinMaxRecordsOk = true; for (uint i=0; i<FeatMinMaxCount; i++) { FeatMinMaxRecord fmmr = GetFeatMinMaxRecord(i); if (fmmr!=null) { if (fmmr.MinCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_FeatMinMaxRecords_MinCO_offset, table.m_tag, sIdentity + ", FeatMinMaxRecord[" + i + "]"); bFeatMinMaxRecordsOk = false; bRet = false; } if (fmmr.MaxCoordOffset + m_offsetMinMaxTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_FeatMinMaxRecords_MaxCO_offset, table.m_tag, sIdentity + ", FeatMinMaxRecord[" + i + "]"); bFeatMinMaxRecordsOk = false; bRet = false; } } else { bFeatMinMaxRecordsOk = false; } } if (bFeatMinMaxRecordsOk) { v.Pass(T.T_NULL, P.BASE_P_FeatMinMaxRecords_offsets, table.m_tag, sIdentity); } // check the BaseCoord Tables BaseCoordTable_val bct = null; bct = GetMinCoordTable_val(); if (bct != null) { bct.Validate(v, sIdentity, table); } bct = GetMaxCoordTable_val(); if (bct != null) { bct.Validate(v, sIdentity, table); } for (uint i=0; i<FeatMinMaxCount; i++) { FeatMinMaxRecord fmmr = GetFeatMinMaxRecord(i); bct = GetFeatMinCoordTable_val(fmmr); if (bct != null) { bct.Validate(v, sIdentity, table); } bct = GetFeatMaxCoordTable_val(fmmr); if (bct != null) { bct.Validate(v, sIdentity, table); } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetBaseCoordTable, CalcLength(), v, sIdentity, table.GetTag()); if (BaseCoordFormat == 1 || BaseCoordFormat == 2 || BaseCoordFormat == 3) { v.Pass(T.T_NULL, P.BASE_P_BaseCoordTable_format, table.m_tag, sIdentity); } else { v.Error(T.T_NULL, E.BASE_E_BaseCoordTable_format, table.m_tag, sIdentity + ", format = " + BaseCoordFormat); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetBaseScriptTable, CalcLength(), v, sIdentity, table.GetTag()); // check the BaseValuesOffset if (BaseValuesOffset == 0) { v.Pass(T.T_NULL, P.BASE_P_BaseValuesOffset_null, table.m_tag, sIdentity); } else if (BaseValuesOffset + m_offsetBaseScriptTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_BaseValuesOffset, table.m_tag, sIdentity); } else { v.Pass(T.T_NULL, P.BASE_P_BaseValuesOffset, table.m_tag, sIdentity); } // check the DefaultMinMaxOffset if (DefaultMinMaxOffset == 0) { v.Pass(T.T_NULL, P.BASE_P_DefaultMinMaxOffset_null, table.m_tag, sIdentity); } else if (DefaultMinMaxOffset + m_offsetBaseScriptTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_DefaultMinMaxOffset, table.m_tag, sIdentity); } else { v.Pass(T.T_NULL, P.BASE_P_DefaultMinMaxOffset, table.m_tag, sIdentity); } // check the BaseLangSysRecord order bool bOrderOk = true; if (BaseLangSysCount > 1) { for (uint i=0; i<BaseLangSysCount-1; i++) { BaseLangSysRecord ThisBlsr = GetBaseLangSysRecord(i); BaseLangSysRecord NextBlsr = GetBaseLangSysRecord(i+1); if (ThisBlsr.BaseLangSysTag >= NextBlsr.BaseLangSysTag) { v.Error(T.T_NULL, E.BASE_E_BaseLangSysRecord_order, table.m_tag, sIdentity); bOrderOk = false; bRet = false; } } } if (bOrderOk) { v.Pass(T.T_NULL, P.BASE_P_BaseLangSysRecord_order, table.m_tag, sIdentity); } // check the BaseLangSysRecord MinMaxOffsets bool bOffsetsOk = true; for (uint i=0; i<BaseLangSysCount; i++) { BaseLangSysRecord bslr = GetBaseLangSysRecord(i); if (bslr.MinMaxOffset == 0) { v.Error(T.T_NULL, E.BASE_E_BaseLangSysRecord_offset0, table.m_tag, sIdentity + ", BaseLangSysRecord index = "+i); bOffsetsOk = false; bRet = false; } else if (bslr.MinMaxOffset + m_offsetBaseScriptTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_BaseLangSysRecord_offset, table.m_tag, sIdentity + ", BaseLangSysRecord index = "+i); bOffsetsOk = false; bRet = false; } } if (bOffsetsOk) { v.Pass(T.T_NULL, P.BASE_P_BaseLangSysRecord_offsets, table.m_tag, sIdentity); } // check the BaseValuesTable if (BaseValuesOffset != 0) { BaseValuesTable_val bvt = GetBaseValuesTable_val(); bvt.Validate(v, sIdentity, table); } // check the Default MinMaxTable if (DefaultMinMaxOffset != 0) { MinMaxTable_val mmt = GetDefaultMinMaxTable_val(); mmt.Validate(v, sIdentity + ", default MinMax", table); } // check the BaseLangSysRecord MinMaxTables for (uint i=0; i<BaseLangSysCount; i++) { BaseLangSysRecord blsr = GetBaseLangSysRecord(i); MinMaxTable_val mmt = GetMinMaxTable_val(blsr); mmt.Validate(v, sIdentity + ", BaseLangSysRecord[" + i + "]", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetBaseValuesTable, CalcLength(), v, sIdentity, table.GetTag()); // check BaseCoord offsets bool bOffsetsOk = true; for (uint i=0; i<BaseCoordCount; i++) { ushort bco = GetBaseCoordOffset(i); if (bco == 0) { v.Error(T.T_NULL, E.BASE_E_BaseValuesTable_BCO_0, table.m_tag, sIdentity + ", BaseCoordOffset index = " + i); bOffsetsOk = false; bRet = false; } else if (bco + m_offsetBaseValuesTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_BaseValuesTable_BCO_invalid, table.m_tag, sIdentity + ", BaseCoordOffset index = " + i); bOffsetsOk = false; bRet = false; } } if (bOffsetsOk) { v.Pass(T.T_NULL, P.BASE_P_BaseValuesTable_BCO, table.m_tag, sIdentity); } // check the BaseCoord tables for (uint i=0; i<BaseCoordCount; i++) { BaseCoordTable_val bct = GetBaseCoordTable_val(i); bct.Validate(v, sIdentity, table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetBaseScriptListTable, CalcLength(), v, sIdentity, table.GetTag()); bool bOrderOk = true; if (BaseScriptCount > 1) { for (uint i=0; i<BaseScriptCount-1; i++) { BaseScriptRecord ThisBsr = GetBaseScriptRecord(i); BaseScriptRecord NextBsr = GetBaseScriptRecord(i+1); if (ThisBsr.BaseScriptTag >= NextBsr.BaseScriptTag) { v.Error(T.T_NULL, E.BASE_E_BaseScriptList_Order, table.m_tag, sIdentity); bOrderOk = false; bRet = false; break; } } } if (bOrderOk) { v.Pass(T.T_NULL, P.BASE_P_BaseScriptList_Order, table.m_tag, sIdentity); } bool bOffsetsOk = true; for (uint i=0; i<BaseScriptCount; i++) { BaseScriptRecord bsr = GetBaseScriptRecord(i); if (bsr.BaseScriptOffset + m_offsetBaseScriptListTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_BaseScriptList_Offset, table.m_tag, sIdentity + ", index = "+i); bOffsetsOk = false; bRet = false; } } if (bOffsetsOk) { v.Pass(T.T_NULL, P.BASE_P_BaseScriptList_Offset, table.m_tag, sIdentity); } for (uint i=0; i<BaseScriptCount; i++) { BaseScriptRecord bsr = GetBaseScriptRecord(i); BaseScriptTable_val bst = GetBaseScriptTable_val(bsr); bst.Validate(v, sIdentity + ", BaseScriptRecord[" + i + "](" + bsr.BaseScriptTag + ")", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetBaseTagListTable, CalcLength(), v, sIdentity, table.GetTag()); bool bTagsValid = true; for (uint i=0; i<BaseTagCount; i++) { OTTag BaselineTag = GetBaselineTag(i); if (!BaselineTag.IsValid()) { v.Error(T.T_NULL, E.BASE_E_BaseTagList_TagValid, table.m_tag, sIdentity + ", tag = 0x" + ((uint)BaselineTag).ToString("x8")); bTagsValid = false; bRet = false; } } if (bTagsValid) { v.Pass(T.T_NULL, P.BASE_P_BaseTagList_TagValid, table.m_tag, sIdentity); } bool bOrderOk = true; if (BaseTagCount > 1) { for (uint i=0; i<BaseTagCount-1; i++) { OTTag ThisTag = GetBaselineTag(i); OTTag NextTag = GetBaselineTag(i+1); if (ThisTag >= NextTag) { v.Error(T.T_NULL, E.BASE_E_BaseTagList_TagOrder, table.m_tag, sIdentity); bOrderOk = false; bRet = false; break; } } } if (bOrderOk) { v.Pass(T.T_NULL, P.BASE_P_BaseTagList_TagOrder, table.m_tag, sIdentity); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetAxisTable, CalcLength(), v, sIdentity, table.GetTag()); if (BaseTagListOffset == 0) { v.Pass(T.T_NULL, P.BASE_P_AxisTable_BaseTagListOffset_null, table.m_tag, sIdentity); } else if (BaseTagListOffset + m_offsetAxisTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_AxisTable_BaseTagListOffset, table.m_tag, sIdentity); bRet = false; } else { v.Pass(T.T_NULL, P.BASE_P_AxisTable_BaseTagListOffset_valid, table.m_tag, sIdentity); BaseTagListTable_val btlt = GetBaseTagListTable_val(); btlt.Validate(v, sIdentity, table); } if (BaseScriptListOffset == 0) { v.Error(T.T_NULL, E.BASE_E_AxisTable_BaseScriptListOffset_null, table.m_tag, sIdentity); bRet = false; } else if (BaseScriptListOffset + m_offsetAxisTable > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.BASE_E_AxisTable_BaseScriptListOffset, table.m_tag, sIdentity); bRet = false; } else { v.Pass(T.T_NULL, P.BASE_P_AxisTable_BaseScriptListOffset_valid, table.m_tag, sIdentity); BaseScriptListTable_val bslt = GetBaseScriptListTable_val(); bslt.Validate(v, sIdentity, table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_GDEF)table).ValidateNoOverlap(m_offsetLigGlyphTable, CalcLength(), v, sIdentity, table.GetTag()); if (m_offsetLigGlyphTable + (uint)FieldOffsets.CaretValueOffsets + CaretCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GDEF_E_LigGlyphTable_CaretValueArray_PastEOT, table.m_tag, sIdentity); bRet = false; } bool bOffsetsOk = true; for (uint i=0; i<CaretCount; i++) { if (m_offsetLigGlyphTable + GetCaretValueOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GDEF_E_LigGlyphTable_CaretValueOffset, table.m_tag, sIdentity); bOffsetsOk = false; bRet = false; } } if (bOffsetsOk) { v.Pass(T.T_NULL, P.GDEF_P_LigGlyphTable_CaretValueArray, table.m_tag, sIdentity); } for (uint i=0; i<CaretCount; i++) { CaretValueTable cvt = GetCaretValueTable(i); if (cvt.CaretValueFormat < 1 || cvt.CaretValueFormat > 3) { v.Error(T.T_NULL, E.GDEF_E_CaretValueTable_Format, table.m_tag, sIdentity + ", CaretValue[" + i + "], format = " + cvt.CaretValueFormat); bRet = false; } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_JSTF)table).ValidateNoOverlap(m_offsetJstfScript, CalcLength(), v, sIdentity, table.GetTag()); // check the ExtenderGlyph offset if (ExtenderGlyphOffset != 0) { if (m_offsetJstfScript + ExtenderGlyphOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtenderGlyph"); bRet = false; } } // check the ExtenderGlyph table if (ExtenderGlyphOffset != 0) { ExtenderGlyph_val eg = GetExtenderGlyphTable_val(); bRet &= eg.Validate(v, sIdentity + ", ExtenderGlyph", table); } // check the DefJstfLangSys offset if (DefJstfLangSysOffset != 0) { if (m_offsetJstfScript + DefJstfLangSysOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", DefJstfLangSys"); bRet = false; } } // check the DefJstfLangSys table if (DefJstfLangSysOffset != 0) { JstfLangSys_val jls = GetDefJstfLangSysTable_val(); bRet &= jls.Validate(v, sIdentity + ", DefJstfLangSys", table); } // check the JstfLangSysRecord array length if (m_offsetJstfScript + (uint)FieldOffsets.JstfLangSysRecords + JstfLangSysCount*6 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Array_pastEOT, table.m_tag, sIdentity + ", JstfLangSysRecord array"); bRet = false; } // check the JstfLangSysRecord array order if (JstfLangSysCount > 1) { for (uint i=0; i<JstfLangSysCount-1; i++) { JstfLangSysRecord jlsrCurr = GetJstfLangSysRecord(i); JstfLangSysRecord jlsrNext = GetJstfLangSysRecord(i); if (jlsrCurr.JstfLangSysTag >= jlsrNext.JstfLangSysTag) { v.Error(T.T_NULL, E.JSTF_E_Array_order, table.m_tag, sIdentity + ", JstfLangSysRecord[" + i + "]"); bRet = false; break; } } } // check each JstfLangSysRecord for (uint i=0; i<JstfLangSysCount; i++) { JstfLangSysRecord jlsr = GetJstfLangSysRecord(i); // check the tag if (!jlsr.JstfLangSysTag.IsValid()) { v.Error(T.T_NULL, E.JSTF_E_tag, table.m_tag, sIdentity + ", JstfLangSysRecord[" + i + "]"); bRet = false; } // check the JstfLangSys offset if (m_offsetJstfScript + jlsr.JstfLangSysOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", JstfLangSysRecord[" + i + "]"); bRet = false; } // check the JstfLangSys table JstfLangSys_val jls = GetJstfLangSysTable_val(jlsr); bRet &= jls.Validate(v, sIdentity + ", JstfLangSysRecord[" + i + "], JstfLangSys", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_GDEF)table).ValidateNoOverlap(m_offsetMarkGlyphSetsDefTable, CalcLength(), v, sIdentity, table.GetTag()); if (MarkSetTableFormat != 1) { v.Error(T.T_NULL, E.GDEF_E_MarkSetTableFormat, table.m_tag, sIdentity + ": MarkSetTableFormat=" + MarkSetTableFormat.ToString()); bRet = false; } if (m_offsetMarkGlyphSetsDefTable + CalcLength() > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GDEF_E_MarkGlyphSetsDefTable_PastEOT, table.m_tag, sIdentity); bRet = false; } v.Info(T.T_NULL, I.GDEF_I_MarkSetCount, table.m_tag, sIdentity + ": MarkSetCount=" + MarkSetCount); // TODO: check Coverage [MarkSetCount] array? if (bRet) { v.Pass(T.T_NULL, P.GDEF_P_MarkGlyphSetsDefTable, table.m_tag, sIdentity); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_JSTF)table).ValidateNoOverlap(m_offsetExtenderGlyph, CalcLength(), v, sIdentity, table.GetTag()); // check the ExtenderGlyph array length if (m_offsetExtenderGlyph + (uint)FieldOffsets.ExtenderGlyphs + GlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Array_pastEOT, table.m_tag, sIdentity + ", ExtenderGlyph array"); bRet = false; } // check that the ExtenderGlyph array is in increasing numerical order if (GlyphCount > 1) { for (uint i=0; i<GlyphCount-1; i++) { if (GetExtenderGlyph(i) >= GetExtenderGlyph(i+1)) { v.Error(T.T_NULL, E.JSTF_E_Array_order, table.m_tag, sIdentity + ", ExtenderGlyph array"); bRet = false; break; } } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetChainContextSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the coverage offset if (m_offsetChainContextSubst + CoverageOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", Coverage offset"); bRet = false; } // check the coverage table CoverageTable_val ct = GetCoverageTable_val(); bRet &= ct.Validate(v, sIdentity + ", Coverage table", table); // check the BacktrackClassDef offset if (m_offsetChainContextSubst + BacktrackClassDefOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", BacktrackClassDef offset"); bRet = false; } // check the BacktrackClassDef table ClassDefTable_val bcd = GetBacktrackClassDefTable_val(); bRet &= bcd.Validate(v, sIdentity + ", BacktrackClassDef", table); // check the InputClassDef offset if (m_offsetChainContextSubst + InputClassDefOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", InputClassDef offset"); bRet = false; } // check the InputClassDef table ClassDefTable_val icd = GetInputClassDefTable_val(); bRet &= icd.Validate(v, sIdentity + ", InputClassDef", table); // check the LookaheadClassDef offset if (m_offsetChainContextSubst + LookaheadClassDefOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", LookaheadClassDef offset"); bRet = false; } // check the LookaheadClassDef table ClassDefTable_val lcd = GetLookaheadClassDefTable_val(); bRet &= lcd.Validate(v, sIdentity + ", LookaheadClassDef", table); // check the ChainSubClassSet array length if (m_offsetChainContextSubst + (uint)FieldOffsets.ChainSubClassSetOffsets + ChainSubClassSetCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", ChainSubClassSet array"); bRet = false; } // check each ChainSubClassSet offset for (uint i=0; i<ChainSubClassSetCount; i++) { if (GetChainSubClassSetOffset(i) != 0) { if (m_offsetChainContextSubst + GetChainSubClassSetOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", ChainSubClassSet[" + i + "]"); bRet = false; } } } // check each ChainSubClassSet table for (uint i=0; i<ChainSubClassSetCount; i++) { if (GetChainSubClassSetOffset(i) != 0) { ChainSubClassSet_val cscs = GetChainSubClassSetTable_val(i); bRet &= cscs.Validate(v, sIdentity + ", ChainSubClassSet[" + i + "]", table); } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_JSTF)table).ValidateNoOverlap(m_offsetJstfLangSys, CalcLength(), v, sIdentity, table.GetTag()); // check the JstfPriority array length if (m_offsetJstfLangSys + (uint)FieldOffsets.JstfPriorityOffsets + JstfPriorityCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Array_pastEOT, table.m_tag, sIdentity + ", JstfPriority array"); bRet = false; } // check each JstfPriority offset for (uint i=0; i<JstfPriorityCount; i++) { if (m_offsetJstfLangSys + GetJstfPriorityOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", JstfPriority[" + i + "]"); bRet = false; } } // check each JstfPriority table for (uint i=0; i<JstfPriorityCount; i++) { JstfPriority_val jp = GetJstfPriorityTable_val(i); bRet &= jp.Validate(v, sIdentity + ", JstfPriority[" + i + "]", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; sIdentity += "(ExtensionSubst)"; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetExtensionSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the SubstFormat if (SubstFormat != 1) { v.Error(T.T_NULL, E.GSUB_E_SubtableFormat, table.m_tag, sIdentity + ", SubstFormat = " + SubstFormat); bRet = false; } // check the ExtensionLookupType if (ExtensionLookupType >= 7) { v.Error(T.T_NULL, E.GSUB_E_ExtensionLookupType, table.m_tag, sIdentity + ", ExtensionLookupType = " + ExtensionLookupType); bRet = false; } // check the ExtensionOffset if (m_offsetExtensionSubst + ExtensionOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtensionOffset"); bRet = false; } if (bRet) { v.Pass(T.T_NULL, P.GSUB_P_ExtensionSubst, table.m_tag, sIdentity); } // validate the subtable SubTable st = null; switch (ExtensionLookupType) { case 1: st = new val_GSUB.SingleSubst_val (m_offsetExtensionSubst + ExtensionOffset, m_bufTable); break; case 2: st = new val_GSUB.MultipleSubst_val (m_offsetExtensionSubst + ExtensionOffset, m_bufTable); break; case 3: st = new val_GSUB.AlternateSubst_val (m_offsetExtensionSubst + ExtensionOffset, m_bufTable); break; case 4: st = new val_GSUB.LigatureSubst_val (m_offsetExtensionSubst + ExtensionOffset, m_bufTable); break; case 5: st = new val_GSUB.ContextSubst_val (m_offsetExtensionSubst + ExtensionOffset, m_bufTable); break; case 6: st = new val_GSUB.ChainContextSubst_val(m_offsetExtensionSubst + ExtensionOffset, m_bufTable); break; } if (st != null) { I_OTLValidate iv = (I_OTLValidate)st; iv.Validate(v, sIdentity, table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_JSTF)table).ValidateNoOverlap(m_offsetJstfPriority, CalcLength(), v, sIdentity, table.GetTag()); // check the ShrinkageEnableGSUB offset if (ShrinkageEnableGSUBOffset != 0) { if (m_offsetJstfPriority + ShrinkageEnableGSUBOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ShrinkageEnableGSUB"); bRet = false; } } // check the ShrinkageEnableGSUB table if (ShrinkageEnableGSUBOffset != 0) { JstfGSUBModList_val jgml = GetShrinkageEnableGSUBTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ShrinkageEnableGSUB", table); } // check the ShrinkageDisableGSUB offset if (ShrinkageDisableGSUBOffset != 0) { if (m_offsetJstfPriority + ShrinkageDisableGSUBOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ShrinkageDisableGSUB"); bRet = false; } } // check the ShrinkageDisableGSUB table if (ShrinkageDisableGSUBOffset != 0) { JstfGSUBModList_val jgml = GetShrinkageDisableGSUBTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ShrinkageDisableGSUB", table); } // check the ShrinkageEnableGPOS offset if (ShrinkageEnableGPOSOffset != 0) { if (m_offsetJstfPriority + ShrinkageEnableGPOSOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ShrinkageEnableGPOS"); bRet = false; } } // check the ShrinkageEnableGPOS table if (ShrinkageEnableGPOSOffset != 0) { JstfGPOSModList_val jgml = GetShrinkageEnableGPOSTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ShrinkageEnableGPOS", table); } // check the ShrinkageDisableGPOS offset if (ShrinkageDisableGPOSOffset != 0) { if (m_offsetJstfPriority + ShrinkageDisableGPOSOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ShrinkageDisableGPOS"); bRet = false; } } // check the ShrinkageDisableGPOS table if (ShrinkageDisableGPOSOffset != 0) { JstfGPOSModList_val jgml = GetShrinkageDisableGPOSTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ShrinkageDisableGPOS", table); } // check the ShrinkageJstfMax offset if (ShrinkageJstfMaxOffset != 0) { if (m_offsetJstfPriority + ShrinkageJstfMaxOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ShrinkageJstfMax"); bRet = false; } } // check the ShrinkageJstfMax table if (ShrinkageJstfMaxOffset != 0) { JstfMax_val jm = GetShrinkageJstfMaxTable_val(); bRet &= jm.Validate(v, sIdentity + ", ShrinkageJstfMax", table); } // check the ExtensionEnableGSUB offset if (ExtensionEnableGSUBOffset != 0) { if (m_offsetJstfPriority + ExtensionEnableGSUBOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtensionEnableGSUB"); bRet = false; } } // check the ExtensionEnableGSUB table if (ExtensionEnableGSUBOffset != 0) { JstfGSUBModList_val jgml = GetExtensionEnableGSUBTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ExtensionEnableGSUB", table); } // check the ExtensionDisableGSUB offset if (ExtensionDisableGSUBOffset != 0) { if (m_offsetJstfPriority + ExtensionDisableGSUBOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtensionDisableGSUB"); bRet = false; } } // check the ExtensionDisableGSUB table if (ExtensionDisableGSUBOffset != 0) { JstfGSUBModList_val jgml = GetExtensionDisableGSUBTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ExtensionDisableGSUB", table); } // check the ExtensionEnableGPOS offset if (ExtensionEnableGPOSOffset != 0) { if (m_offsetJstfPriority + ExtensionEnableGPOSOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtensionEnableGPOS"); bRet = false; } } // check the ExtensionEnableGPOS table if (ExtensionEnableGPOSOffset != 0) { JstfGPOSModList_val jgml = GetExtensionEnableGPOSTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ExtensionEnableGPOS", table); } // check the ExtensionDisableGPOS offset if (ExtensionDisableGPOSOffset != 0) { if (m_offsetJstfPriority + ExtensionDisableGPOSOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtensionDisableGPOS"); bRet = false; } } // check the ExtensionDisableGPOS table if (ExtensionDisableGPOSOffset != 0) { JstfGPOSModList_val jgml = GetExtensionDisableGPOSTable_val(); bRet &= jgml.Validate(v, sIdentity + ", ExtensionDisableGPOS", table); } // check the ExtensionJstfMax offset if (ExtensionJstfMaxOffset != 0) { if (m_offsetJstfPriority + ExtensionJstfMaxOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtensionJstfMax"); bRet = false; } } // check the ExtensionJstfMax table if (ExtensionJstfMaxOffset != 0) { JstfMax_val jm = GetExtensionJstfMaxTable_val(); bRet &= jm.Validate(v, sIdentity + ", ExtensionJstfMax", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetSingleSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the coverage offset if (m_offsetSingleSubst + CoverageOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", Coverage offset"); bRet = false; } // check the coverage table CoverageTable_val ct = GetCoverageTable_val(); bRet &= ct.Validate(v, sIdentity + ", Coverage", table); // check the Substitute array length if (m_offsetSingleSubst + (uint)FieldOffsets.SubstituteGlyphIDs + GlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", Substitute array"); bRet = false; } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_JSTF)table).ValidateNoOverlap(m_offsetJstfGPOSModList, CalcLength(), v, sIdentity, table.GetTag()); // check GPOSLookupIndex array size if (m_offsetJstfGPOSModList + (uint)FieldOffsets.GPOSLookupIndex + LookupCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Array_pastEOT, table.m_tag, sIdentity + ", GPOSLookupIndex"); bRet = false; } // check that GPOSLookupIndex is in increasing numerical order if (LookupCount > 1) { for (uint i=0; i<LookupCount-1; i++) { if (GetGPOSLookupIndex(i) >= GetGPOSLookupIndex(i+1)) { v.Error(T.T_NULL, E.JSTF_E_Array_order, table.m_tag, sIdentity + ", GPOSLookupIndex"); bRet = false; break; } } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; sIdentity += "(LigatureSubst, fmt " + SubstFormat + ")"; if (SubstFormat == 1) { // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetLigatureSubst, CalcLength(), v, sIdentity, table.GetTag()); // check the coverage offset if (m_offsetLigatureSubst + CoverageOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", Coverage offset"); bRet = false; } // check the coverage table CoverageTable_val ct = GetCoverageTable_val(); bRet &= ct.Validate(v, sIdentity + ", Coverage", table); // check the LigatureSet array length if (m_offsetLigatureSubst + (uint)FieldOffsets.LigatureSetOffsets + LigSetCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", LigatureSet array"); bRet = false; } // check each LigatureSet offset for (uint i=0; i<LigSetCount; i++) { if (m_offsetLigatureSubst + GetLigatureSetOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", LigatureSet[" + i + "]"); bRet = false; } } // check each LigatureSet table for (uint i=0; i<LigSetCount; i++) { LigatureSet_val ls = GetLigatureSetTable_val(i); bRet &= ls.Validate(v, sIdentity + ", LigatureSet[" + i + "]", table); } } else { v.Error(T.T_NULL, E.GSUB_E_SubtableFormat, table.m_tag, sIdentity); bRet = false; } if (bRet) { v.Pass(T.T_NULL, P.GSUB_P_LigatureSubst, table.m_tag, sIdentity); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_JSTF)table).ValidateNoOverlap(m_offsetJstfMax, CalcLength(), v, sIdentity, table.GetTag()); // check the Lookup array length if (m_offsetJstfMax + (uint)FieldOffsets.LookupOffsets + LookupCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Array_pastEOT, table.m_tag, sIdentity + ", Lookup"); bRet = false; } // check each Lookup offset for (uint i=0; i<LookupCount; i++) { if (m_offsetJstfMax + GetLookupOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.JSTF_E_Offset_PastEOT, table.m_tag, sIdentity + ", Lookup[" + i + "]"); bRet = false; } } // check each Lookup table for (uint i=0; i<LookupCount; i++) { LookupTable_val lt = GetLookupTable_val(i); bRet &= lt.Validate(v, sIdentity + ", Lookup[" + i + "]", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetSubRule, CalcLength(), v, sIdentity, table.GetTag()); // check the Input array length if (m_offsetSubRule + (uint)FieldOffsets.InputGlyphIds + (GlyphCount-1)*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", Input array"); bRet = false; } // check the SubstLookupRecord array length uint offset = m_offsetSubRule + (uint)FieldOffsets.InputGlyphIds + (uint)(GlyphCount-1)*2; if (offset + SubstCount*4 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", SubstLookupRecord array"); bRet = false; } // check each SubstLookupRecord for (uint i=0; i<SubstCount; i++) { SubstLookupRecord slr = GetSubstLookupRecord(i); if (slr.SequenceIndex > GlyphCount) { string sValues = ", slr.SequenceIndex = " + slr.SequenceIndex + ", slr.LookupListIndex = " + slr.LookupListIndex + ", GlyphCount = " + GlyphCount; v.Error(T.T_NULL, E.GSUB_E_SubstLookupRecord_SequenceIndex, table.m_tag, sIdentity + ", SubstLookupRecord[" + i + "]" + sValues); bRet = false; } } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_GDEF)table).ValidateNoOverlap(m_offsetLigCaretListTable, CalcLength(), v, sIdentity, table.GetTag()); if (CoverageOffset == 0) { v.Error(T.T_NULL, E.GDEF_E_LigCaretListTable_CoverageOffset_0, table.m_tag, sIdentity); bRet = false; } else if (CoverageOffset > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GDEF_E_LigCaretListTable_CoverageOffset_invalid, table.m_tag, sIdentity); bRet = false; } else { v.Pass(T.T_NULL, P.GDEF_P_LigCaretListTable_CoverageOffset, table.m_tag, sIdentity); CoverageTable_val ct = GetCoverageTable_val(); ct.Validate(v, sIdentity + ", Coverage", table); } if (m_offsetLigCaretListTable + (uint)FieldOffsets.LigGlyphOffsets + LigGlyphCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GDEF_E_LigCaretListTable_LigGlyphArray_PastEOT, table.m_tag, sIdentity); bRet = false; } bool bOffsetsOk = true; for (uint i=0; i<LigGlyphCount; i++) { if (m_offsetLigCaretListTable + GetLigGlyphOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GDEF_E_LigCaretListTable_LigGlyphOffset, table.m_tag, sIdentity + ", index = " + i); bOffsetsOk = false; bRet = false; } else { LigGlyphTable_val lgt = GetLigGlyphTable_val(i); lgt.Validate(v, sIdentity + ", LigGlyph[" + i + "]", table); } } if (bOffsetsOk) { v.Pass(T.T_NULL, P.GDEF_P_LigCaretListTable_LigGlyphArray, table.m_tag, sIdentity); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GSUB)table).ValidateNoOverlap(m_offsetSubClassSet, CalcLength(), v, sIdentity, table.GetTag()); // check the SubClassRule array length if (m_offsetSubClassSet + (uint)FieldOffsets.SubClassRuleOffsets + SubClassRuleCount*2 > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Array_pastEOT, table.m_tag, sIdentity + ", SubClassRule array"); bRet = false; } // check each SubClassRule offset for (uint i=0; i<SubClassRuleCount; i++) { if (m_offsetSubClassSet + GetSubClassRuleOffset(i) > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GSUB_E_Offset_PastEOT, table.m_tag, sIdentity + ", SubClassRule[" + i + "]"); bRet = false; } } // check each SubClassRule table for (uint i=0; i<SubClassRuleCount; i++) { SubClassRule_val scr = GetSubClassRuleTable_val(i); bRet &= scr.Validate(v, sIdentity + ", SubClassRule[" + i + "]", table); } return bRet; }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; // check for data overlap bRet &= ((val_GPOS)table).ValidateNoOverlap(m_offsetPairSetTable, CalcLength(), v, sIdentity, table.GetTag()); // check that PairValueRecord array doesn't extend past end of table uint sizeofPairValueRecord = 2 + ValueRecord.SizeOfValueRecord(m_ValueFormat1) + ValueRecord.SizeOfValueRecord(m_ValueFormat2); if (m_offsetPairSetTable + (uint)FieldOffsets.PairValueRecordArray + PairValueCount*sizeofPairValueRecord > m_bufTable.GetLength()) { v.Error(T.T_NULL, E.GPOS_E_Array_pastEOT, table.m_tag, sIdentity + ", PairValueRecord"); bRet = false; } // check the PairValue record order if (PairValueCount > 1) { for (uint i=0; i<PairValueCount-1; i++) { PairValueRecord pvrThis = GetPairValueRecord(i); PairValueRecord pvrNext = GetPairValueRecord(i+1); if (pvrThis.SecondGlyph >= pvrNext.SecondGlyph) { v.Error(T.T_NULL, E.GPOS_E_Array_order, table.m_tag, sIdentity + ", PairValueRecord"); bRet = false; } } } // validate the PairValueRecords for (uint i=0; i<PairValueCount; i++) { PairValueRecord_val pvr = GetPairValueRecord_val(i); pvr.Validate(v, sIdentity + ", PairValueRecord[" + i + "]", table); } if (bRet) { v.Pass(T.T_NULL, P.GPOS_P_PairSet, table.m_tag, sIdentity); } return bRet; }