Beispiel #1
0
        /*
         *        METHODS    :    VALIDATORS SOURCE
         */
        internal StatusGV.TypeStatusExec ValidateTypeGlyphSource(GErrList gerrlist)
        {
            DIAction dia = DIActionBuilder.DIA(gerrlist, "DIAFunc_AddToListUnique");

            gerrlist.DIW = new DIWrapperSource(this.index,
                                               GConsts.TypeGlyph.Undef,
                                               GScope.TypeGScope._GG_);

            I_IOGlyphs i_IOGlyphs = this.fm.IIOGlyphs;

            if (i_IOGlyphs == null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateTypeGlyphSource",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }

            int numErrBefore = gerrlist.Length;

            i_IOGlyphs.ReadTypeGlyph(this.index, out this.typeGlyph, dia);
            int numErrAfter = gerrlist.Length;
            int iErr;

            for (iErr = numErrBefore; iErr < numErrAfter; iErr++)
            {
                gerrlist[iErr].TypeGlyph = this.typeGlyph;
            }
            gerrlist.DIW = null;
            return(StatusGV.TypeStatusExec.Completed);
        }
Beispiel #2
0
        /*
         *        METHODS PUBLIC: dumps
         */

        public void GErrListAdd(GErrList gerrlist)
        {
            if (gerrlist == null)
            {
                return;
            }
            gerrlist.ApplyToEach(DIActionBuilder.DIA(this, "DIAFunc_AddToPool"));
        }
Beispiel #3
0
        internal StatusGV.TypeStatusExec ValidateCompSource(GErrList gerrlist)
        {
            if (this.bbox != null)
            {
                this.bbox.Clear();
                this.bbox = null;
            }
            if (this.comp != null)
            {
                this.comp.ClearDestroy();
                this.comp = null;
            }
            if (this.outl != null)
            {
                this.outl.ClearDestroy();
                this.outl = null;
            }

            if (this.typeGlyph == GConsts.TypeGlyph.Empty)
            {
                return(StatusGV.TypeStatusExec.Completed);
            }
            if (this.typeGlyph != GConsts.TypeGlyph.Composite)
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompSource",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            DIAction dia = DIActionBuilder.DIA(gerrlist, "DIAFunc_AddToListUnique");

            gerrlist.DIW = new DIWrapperSource(this.index, this.typeGlyph, GScope.TypeGScope._GGB_);

            I_IOGlyphs i_IOGlyphs = this.fm.IIOGlyphs;

            if (i_IOGlyphs == null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompSource",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            i_IOGlyphs.ReadGGB(this.index, out this.bbox, dia);
            i_IOGlyphs.ReadGGC(this.index, out this.comp, dia);
            if (this.comp != null)
            {
                this.fm.OnGComposite(this.index);
            }


            gerrlist.DIW = null;
            return(StatusGV.TypeStatusExec.Completed);
        }
Beispiel #4
0
        public bool Validate(Validator validator, OTFontVal fontOwner)
        {
            bool bRet = true;

            if (!validator.PerformTest(T.glyf_ValidateAll))
            {
                return(true);
            }

            this.m_diaValidate = validator.DIA;
            this.m_cnts        = new int[this.m_namesInfoCnt.Length];
            for (int iCnt = 0; iCnt < this.m_cnts.Length; iCnt++)
            {
                this.m_cnts[iCnt] = 0;
            }

            I_IOGlyphsFile i_IOGlyphs = new I_IOGlyphsFile();

            if (!i_IOGlyphs.Initialize(fontOwner, validator))
            {
                return(false); // the error is already reported
            }

            DIAction diaFilter =
                DIActionBuilder.DIA(this, "DIAFunc_Filter");
            FManager fm       = new FManager(i_IOGlyphs, null, null);
            int      numGlyph = fm.FNumGlyph;
            int      indGlyph;

            for (indGlyph = 0; indGlyph < numGlyph; indGlyph++)
            {
                try
                {
                    validator.OnTableProgress("Validating glyph with index " + indGlyph + " (out of " + numGlyph + " glyphs)");
                    Glyph glyph = fm.GGet(indGlyph);
                    glyph.GValidate();
                    bRet &= fm.GErrGetInformed(indGlyph, diaFilter);
                    fm.ClearManagementStructs();
                }
                catch
                {
                    validator.Error(T.T_NULL, E.glyf_E_ExceptionUnhandeled, (OTTag)"glyf",
                                    "Glyph index " + indGlyph);
                }
                if (validator.CancelFlag)
                {
                    break;
                }
            }
            i_IOGlyphs.Clear();
            fm.ClearDestroy();
            fm = null;

/*
 *          I_ProgressUpdater i_ProgressUpdater=new ValidationCancel(validator);
 *
 *          FManager fm=new FManager(i_IOGlyphs, null, null);
 *          DIAction diaFilter=
 *              DIActionBuilder.DIA(this,"DIAFunc_Filter");
 *
 *          fm.GErrActionAdd(diaFilter,
 *              FManager.TypeActionOnErr.onAdd);
 *
 *
 *          fm.FValidate(GConsts.IND_UNINITIALIZED,
 *              GConsts.IND_UNINITIALIZED);
 *
 *          i_IOGlyphs.Clear();
 *          i_ProgressUpdater.Clear();
 *          fm.ClearDestroy();
 *          fm=null;
 */
            for (int iCnt = 0; iCnt < this.m_cnts.Length; iCnt++)
            {
                if (this.m_cnts[iCnt] > 0)
                {
                    bool   isGErr         = this.m_namesInfoCnt[iCnt].StartsWith("GERR_");
                    string nameFileErr    = isGErr? GErrConsts.FILE_RES_GERR_STRINGS: GErrConsts.FILE_RES_OTFFERR_STRINGS;
                    string nameAsmFileErr = isGErr? GErrConsts.ASM_RES_GERR_STRINGS: GErrConsts.ASM_RES_OTFFERR_STRINGS;
                    string strDetails     = "Number of glyphs with the warning = " + this.m_cnts[iCnt];
                    if (validator.CancelFlag)
                    {
                        strDetails += " (Validation cancelled)";
                    }
                    ValInfoBasic info = new ValInfoBasic(
                        ValInfoBasic.ValInfoType.Warning,
                        this.m_namesInfoCnt[iCnt],
                        strDetails,
                        nameFileErr,
                        nameAsmFileErr,
                        "glyf",
                        null);
                    validator.DIA(info);
                }
            }

            this.m_cnts = null;
            return(bRet);
        }