public JstfScriptRecord_val GetJstfScriptRecord_val(uint i) { JstfScriptRecord_val jsr = null; if (i < JstfScriptCount) { uint offset = (uint)FieldOffsets.JstfScriptRecords + i * 6; jsr = new JstfScriptRecord_val((ushort)offset, m_bufTable); } return(jsr); }
public bool Validate(Validator v, OTFontVal fontOwner) { bool bRet = true; // check the version if (v.PerformTest(T.JSTF_Version)) { if (Version.GetUint() == 0x00010000) { v.Pass(T.JSTF_Version, P.JSTF_P_Version, m_tag); } else { v.Error(T.JSTF_Version, E.JSTF_E_Version, m_tag, "0x" + Version.GetUint().ToString("x8")); bRet = false; } } // check the JstfScriptRecord array length if (v.PerformTest(T.JSTF_JstfScriptRecord_length)) { if ((uint)FieldOffsets.JstfScriptRecords + JstfScriptCount * 6 > m_bufTable.GetLength()) { v.Error(T.JSTF_JstfScriptRecord_length, E.JSTF_E_Array_pastEOT, m_tag, "JstfScriptRecord array"); bRet = false; } } // check that the JstfScriptRecord array is in alphabetical order if (v.PerformTest(T.JSTF_JstfScriptRecord_order)) { if (JstfScriptCount > 1) { for (uint i = 0; i < JstfScriptCount - 1; i++) { JstfScriptRecord jsrCurr = GetJstfScriptRecord_val(i); JstfScriptRecord jsrNext = GetJstfScriptRecord_val(i + 1); if (jsrCurr.JstfScriptTag >= jsrNext.JstfScriptTag) { v.Error(T.JSTF_JstfScriptRecord_order, E.JSTF_E_Array_order, m_tag, "JstfScriptRecord array"); bRet = false; break; } } } } // check each JstfScriptRecord if (v.PerformTest(T.JSTF_JstfScriptRecords)) { for (uint i = 0; i < JstfScriptCount; i++) { JstfScriptRecord_val jsr = GetJstfScriptRecord_val(i); // check the tag if (!jsr.JstfScriptTag.IsValid()) { v.Error(T.JSTF_JstfScriptRecords, E.JSTF_E_tag, m_tag, "JstfScriptRecord[" + i + "]"); bRet = false; } // check the offset if (jsr.JstfScriptOffset > m_bufTable.GetLength()) { v.Error(T.JSTF_JstfScriptRecords, E.JSTF_E_Offset_PastEOT, m_tag, "JstfScriptRecord[" + i + "]"); bRet = false; } // validate the JstfScript table JstfScript_val js = jsr.GetJstfScriptTable_val(); js.Validate(v, "JstfScriptRecord[" + i + "]", this); } } return(bRet); }
public JstfScriptRecord_val GetJstfScriptRecord_val(uint i) { JstfScriptRecord_val jsr = null; if (i < JstfScriptCount) { uint offset = (uint)FieldOffsets.JstfScriptRecords + i*6; jsr = new JstfScriptRecord_val((ushort)offset, m_bufTable); } return jsr; }