Exemplo n.º 1
0
        public override SubTable GetSubTable(uint i)
        {
            if (i >= SubTableCount)
            {
                throw new ArgumentOutOfRangeException();
            }

            SubTable st = null;
            uint stOffset = m_offsetLookupTable + (uint)GetSubTableOffset(i);

            if ((string)m_tag == "GPOS")
            {
                switch (LookupType)
                {
                    case 1: st = new val_GPOS.SinglePos_val      (stOffset, m_bufTable); break;
                    case 2: st = new val_GPOS.PairPos_val        (stOffset, m_bufTable); break;
                    case 3: st = new val_GPOS.CursivePos_val     (stOffset, m_bufTable); break;
                    case 4: st = new val_GPOS.MarkBasePos_val    (stOffset, m_bufTable); break;
                    case 5: st = new val_GPOS.MarkLigPos_val     (stOffset, m_bufTable); break;
                    case 6: st = new val_GPOS.MarkMarkPos_val    (stOffset, m_bufTable); break;
                    case 7: st = new val_GPOS.ContextPos_val     (stOffset, m_bufTable); break;
                    case 8: st = new val_GPOS.ChainContextPos_val(stOffset, m_bufTable); break;
                    case 9: st = new val_GPOS.ExtensionPos_val   (stOffset, m_bufTable); break;
                }
            }
            else if ((string)m_tag == "GSUB")
            {
                switch (LookupType)
                {
                    case 1: st = new val_GSUB.SingleSubst_val      (stOffset, m_bufTable); break;
                    case 2: st = new val_GSUB.MultipleSubst_val    (stOffset, m_bufTable); break;
                    case 3: st = new val_GSUB.AlternateSubst_val   (stOffset, m_bufTable); break;
                    case 4: st = new val_GSUB.LigatureSubst_val    (stOffset, m_bufTable); break;
                    case 5: st = new val_GSUB.ContextSubst_val     (stOffset, m_bufTable); break;
                    case 6: st = new val_GSUB.ChainContextSubst_val(stOffset, m_bufTable); break;
                    case 7: st = new val_GSUB.ExtensionSubst_val   (stOffset, m_bufTable); break;
                    case 8: st = new val_GSUB.ReverseChainSubst_val(stOffset, m_bufTable); break;
                }
            }
            else
            {
                throw new InvalidOperationException("unknown table type");
            }

            return st;
        }
Exemplo n.º 2
0
            public bool Validate(Validator v, string sIdentity, OTTable table)
            {
                bool bRet = true;

                sIdentity += "(ExtensionPos)";

                // check for data overlap
                bRet &= ((val_GPOS)table).ValidateNoOverlap(m_offsetExtensionPos, CalcLength(), v, sIdentity, table.GetTag());

                // check the PosFormat
                if (PosFormat != 1)
                {
                    v.Error(T.T_NULL, E.GPOS_E_SubtableFormat, table.m_tag, sIdentity + ", PosFormat = " + PosFormat);
                    bRet = false;
                }

                // check the ExtensionLookupType
                if (ExtensionLookupType >= 9)
                {
                    v.Error(T.T_NULL, E.GPOS_E_ExtensionLookupType, table.m_tag, sIdentity + ", ExtensionLookupType = " + ExtensionLookupType);
                    bRet = false;
                }

                // check the ExtensionOffset
                if (m_offsetExtensionPos + ExtensionOffset > m_bufTable.GetLength())
                {
                    v.Error(T.T_NULL, E.GPOS_E_Offset_PastEOT, table.m_tag, sIdentity + ", ExtensionOffset");
                    bRet = false;
                }

                if (bRet)
                {
                    v.Pass(T.T_NULL, P.GPOS_P_ExtensionPos, table.m_tag, sIdentity);
                }

                // validate the subtable
                SubTable st = null;
                switch (ExtensionLookupType)
                {
                    case 1: st = new val_GPOS.SinglePos_val      (m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                    case 2: st = new val_GPOS.PairPos_val        (m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                    case 3: st = new val_GPOS.CursivePos_val     (m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                    case 4: st = new val_GPOS.MarkBasePos_val    (m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                    case 5: st = new val_GPOS.MarkLigPos_val     (m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                    case 6: st = new val_GPOS.MarkMarkPos_val    (m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                    case 7: st = new val_GPOS.ContextPos_val     (m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                    case 8: st = new val_GPOS.ChainContextPos_val(m_offsetExtensionPos + ExtensionOffset, m_bufTable); break;
                }
                if (st != null)
                {
                    I_OTLValidate iv = (I_OTLValidate)st;
                    iv.Validate(v, sIdentity, table);
                }

                return bRet;
            }