Example #1
0
        bool Validate_indexSubHeader(Validator v, indexSubHeader iSH, string sID, OTFontVal fontOwner)
        {
            bool bOk = true;

            Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT");

            if (iSH.indexFormat < 1 || iSH.indexFormat > 5)
            {
                string sDetails = "invalid indexFormat: " + sID + ", indexFormat = " + iSH.indexFormat;
                v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                bOk = false;
            }

            if ((iSH.imageFormat < 1 || iSH.imageFormat > 9 || iSH.imageFormat == 3) &&
                !(version.GetUint() == 0x00030000 &&
                  (iSH.imageFormat == 17 || iSH.imageFormat == 18 || iSH.imageFormat == 19)
                  ))
            {
                string sDetails = "invalid imageFormat: " + sID + ", imageFormat = " + iSH.imageFormat;
                v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                bOk = false;
            }

            bool bInconsistentFormats = false;

            if (iSH.indexFormat == 1 || iSH.indexFormat == 3 || iSH.indexFormat == 4)
            {
                if (iSH.imageFormat == 5)
                {
                    bInconsistentFormats = true;
                }
            }
            else
            {
                if (iSH.imageFormat != 5)
                {
                    bInconsistentFormats = true;
                }
            }
            if (bInconsistentFormats)
            {
                string sDetails = "inconsistent formats: " + sID + ", indexFormat = " + iSH.indexFormat + ", imageFormat = " + iSH.imageFormat;
                v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                bOk = false;
            }

            if (EBDTTable != null)
            {
                if (iSH.imageDataOffset > EBDTTable.GetLength())
                {
                    string sDetails = "invalid imageDataOffset: " + sID + ", imageDataOffset = " + iSH.imageDataOffset;
                    v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                    bOk = false;
                }
            }

            return(bOk);
        }
Example #2
0
            public indexSubTable(uint indexSubTableOffset, MBOBuffer EBLCTableBuf, indexSubTableArray ista)
            {
                m_indexSubTableOffset = indexSubTableOffset;
                m_EBLCTableBuf = EBLCTableBuf;

                header = new indexSubHeader(indexSubTableOffset, EBLCTableBuf);
                m_ista = ista;
            }
Example #3
0
        bool Validate_indexSubHeader(Validator v, indexSubHeader iSH, string sID, OTFontVal fontOwner)
        {
            bool bOk = true;

            Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT");

            if (iSH.indexFormat < 1 || iSH.indexFormat > 5)
            {
                string sDetails = "invalid indexFormat: " + sID + ", indexFormat = " + iSH.indexFormat;
                v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                bOk = false;
            }

            if (iSH.imageFormat < 1 || iSH.imageFormat > 9 || iSH.imageFormat == 3)
            {
                string sDetails = "invalid imageFormat: " + sID + ", imageFormat = " + iSH.imageFormat;
                v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                bOk = false;
            }

            bool bInconsistentFormats = false;
            if (iSH.indexFormat == 1 || iSH.indexFormat == 3 || iSH.indexFormat == 4)
            {
                if (iSH.imageFormat == 5)
                {
                    bInconsistentFormats = true;
                }
            }
            else
            {
                if (iSH.imageFormat != 5)
                {
                    bInconsistentFormats = true;
                }
            }
            if (bInconsistentFormats)
            {
                string sDetails = "inconsistent formats: " + sID + ", indexFormat = " + iSH.indexFormat + ", imageFormat = " + iSH.imageFormat;
                v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                bOk = false;
            }

            if (EBDTTable != null)
            {
                if (iSH.imageDataOffset > EBDTTable.GetLength())
                {
                    string sDetails = "invalid imageDataOffset: " + sID + ", imageDataOffset = " + iSH.imageDataOffset;
                    v.Error(T.EBLC_indexSubTables, E.EBLC_E_indexSubTables, m_tag, sDetails);
                    bOk = false;
                }
            }

            return bOk;
        }