Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        internal StatusGV.TypeStatusExec ValidateCompComponentDupl(GErrList gerrlist)
        {
            ListPairInt pairsIndComponentDupl = new ListPairInt();

            if ((this.comp == null) || (this.outl == null))
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompComponentDupl",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            int numComponent = this.comp.NumComponent;

            for (int pozComponentA = 0; pozComponentA < numComponent - 1; pozComponentA++)
            {
                Component componentA = this.comp.ComponentByPoz(pozComponentA);
                for (int pozComponentB = pozComponentA + 1; pozComponentB < numComponent; pozComponentB++)
                {
                    ListInfoInters linters    = new ListInfoInters();
                    Component      componentB = this.comp.ComponentByPoz(pozComponentB);
                    bool           areDuplicated;
                    this.outl.AreDuplicatedComponents(componentA, componentB, out areDuplicated);
                    if (areDuplicated)
                    {
                        pairsIndComponentDupl.Add(componentA.IndexGlyphComponent,
                                                  componentB.IndexGlyphComponent);
                    }
                }
            }
            if (pairsIndComponentDupl.Count != 0)
            {
                GErr gerr = new GErrComponentDupl(this.index, pairsIndComponentDupl);
                gerrlist.Add(gerr);
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 3
0
        internal StatusGV.TypeStatusExec ValidateSimpContDegen(GErrList gerrlist)
        {
            ArrayList listIndsKnotStart = new ArrayList();

            for (int pozCont = 0; pozCont < this.outl.NumCont; pozCont++)
            {
                Contour cont = this.outl.ContourByPoz(pozCont);
                if (cont.IsDegen)
                {
                    listIndsKnotStart.Add(cont.IndKnotStart);
                }
            }
            int numCont = listIndsKnotStart.Count;

            if (numCont != 0)
            {
                int[] indsKnotStart = new int[numCont];
                for (int iCont = 0; iCont < numCont; iCont++)
                {
                    indsKnotStart[iCont] = (int)listIndsKnotStart[iCont];
                }
                GErr gerr = new GErrContDegen(this.index, indsKnotStart);
                gerrlist.Add(gerr);
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 4
0
        /*
         *        METHODS    :    VALIDATORS CONTENT
         *
         */

        internal StatusGV.TypeStatusExec ValidateSimpBBox(GErrList gerrlist)
        {
            if ((this.bbox == null) || (this.outl == null))
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpBBox",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            BoxD bboxCP;        // bbox for the control points

            bboxCP = this.outl.BBoxCP;
            if (!bbox.Equals(bboxCP))
            {
                GErrBBox gerrBbox = new GErrBBox(this.IndexGlyph,
                                                 this.typeGlyph,
                                                 this.bbox, bboxCP);
                gerrlist.Add(gerrBbox);
            }
            BoxD bboxOutl;        // bbox for Outline

            bboxOutl = this.outl.BBox;
            //bboxOutline.SetEnlargeFU();
            if (!bboxOutl.Equals(bboxCP))
            {
                // warning
                GErrExtremeNotOnCurve gerrExtreme = new
                                                    GErrExtremeNotOnCurve(this.IndexGlyph,
                                                                          this.typeGlyph, bboxCP, bboxOutl);
                gerrlist.Add(gerrExtreme);
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 5
0
        internal StatusGV.TypeStatusExec ValidateSimpContInters(GErrList gerrlist)
        {
            /*
             *        MEANING:    finds ALL intersections:
             *                    including D0, D1 and S/I bezier
             */
            ListInfoInters linters = new ListInfoInters();

            if (this.outl == null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpContInters",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            if (!this.outl.Intersect(linters))
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpContInters",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            if (linters.Count > 0)
            {
                GErr gerr = new GErrContInters(this.index, linters);
                gerrlist.Add(gerr);
                //this.isOrientDefined=false;
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 6
0
        /*
         *        METHODS & DIAS: act on single GERR
         */


        internal void DIAFunc_AddToPool(ValInfoBasic info)
        {
            GErr gerr = info as GErr;

            if (gerr == null)
            {
                throw new ExceptionGlyph("GErrPool", "DIAFunc_AddToPool", null);
            }
            int indexGlyph = gerr.IndexGlyphOwner;

            if (this.gerrlists[indexGlyph] == null)
            {
                this.gerrlists[indexGlyph] = new GErrList();
            }
            GErrList gerrlist      = this.gerrlists[indexGlyph] as GErrList;
            int      numGErrBefore = gerrlist.Length;

            ((GErrList)this.gerrlists[indexGlyph]).DIAFunc_AddToListUnique(gerr);
            int  numGErrAfter = gerrlist.Length;
            bool isAdded      = (numGErrAfter != numGErrBefore);

            if (isAdded)
            {
                if (this.dia_OnErrorAdd.DIA != null)
                {
                    this.dia_OnErrorAdd.DIA(gerr);
                }
            }
        }
Ejemplo n.º 7
0
        /*
         *            FOR DEBUG ONLY
         */
        internal void PrintGErrs(int indGlyph)
        {
            FileInfo     infoFile = new FileInfo("GERRS.txt");
            StreamWriter writer   = infoFile.AppendText();

            writer.WriteLine("===> GLYPH " + indGlyph);

            GErrList gerrlist = this.gerrlists[indGlyph] as GErrList;

            if (gerrlist != null)
            {
                writer.WriteLine("NUMBER of ERRORS: " + gerrlist.Length);
            }
            else
            {
                writer.WriteLine("EMPTY LIST");
                writer.Close();
                return;
            }
            foreach (GErr gerr in gerrlist)
            {
                string str = gerr.Write();
                writer.WriteLine("");
                writer.WriteLine("Error: ");
                writer.Write(str);
            }
            writer.Close();
        }
Ejemplo n.º 8
0
        internal void OnGV(int indGlyph, DefsGV.TypeGV typeGV, GErrList gerrlist)
        {
            Glyph glyph = this.gStore.GGet(indGlyph);

            if (glyph == null)
            {
                throw new ExceptionGlyph("FManager", "OnGV", null);
            }
            glyph.StatusVal(typeGV).IsValid = true;

            bool areValidAll = true;

            for (int iTest = 0; iTest < DefsGV.NumTest; iTest++)
            {
                if (!glyph.StatusVal((DefsGV.TypeGV)iTest).IsValid)
                {
                    areValidAll = false;
                    break;
                }
            }
            if (areValidAll)
            {
                this.indGM.Remove(indGlyph);
            }
            this.gerrPool.GErrListAdd(gerrlist);
        }
Ejemplo n.º 9
0
        /*
         *        METHODS PUBLIC: dumps
         */

        public void GErrListAdd(GErrList gerrlist)
        {
            if (gerrlist == null)
            {
                return;
            }
            gerrlist.ApplyToEach(DIActionBuilder.DIA(this, "DIAFunc_AddToPool"));
        }
Ejemplo n.º 10
0
 public void InformAll(DIAction diaToApply)
 {
     // get information about ALL GLYPHS
     foreach (DictionaryEntry entry in this.gerrlists)
     {
         GErrList gerrlist = entry.Value as GErrList;
         gerrlist.ApplyToEach(diaToApply);
     }
 }
Ejemplo n.º 11
0
 static public void Sign(GErrList gerrlist, DefsGV.TypeGV typeGV, params int[] indsGlyph)
 {
     if (gerrlist == null)
     {
         throw new ExceptionGlyph("GErrSign", "Sign", "Null argument");
     }
     foreach (GErr gerr in gerrlist)
     {
         Sign(gerr, typeGV, indsGlyph);
     }
 }
Ejemplo n.º 12
0
 static public void Sign(GErrList gerrlist, DefsGV.TypeGV typeGV, params int[] indsGlyph)
 {
     if (gerrlist==null)
     {
         throw new ExceptionGlyph("GErrSign","Sign","Null argument");
     }
     foreach (GErr gerr in gerrlist)
     {
         Sign(gerr,typeGV,indsGlyph);
     }
 }
Ejemplo n.º 13
0
 public void ClearReset()
 {
     foreach (DictionaryEntry entry in this.gerrlists)
     {
         GErrList gerrlist = entry.Value as GErrList;
         if (gerrlist != null)
         {
             gerrlist.ClearDestroy();
         }
     }
     this.gerrlists.Clear();
 }
Ejemplo n.º 14
0
        internal StatusGV.TypeStatusExec ValidateSimpContWrap(GErrList gerrlist)
        {
            /*
             *        ASSUMPTION: determines only "fully" wrapped contours
             */
            if (this.outl == null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpContWrap",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }

            ArrayList pozsContWrap = new ArrayList();

            for (int pozCont = 0; pozCont < this.outl.NumCont; pozCont++)
            {
                Contour cont = this.outl.ContourByPoz(pozCont);
                bool    isWrapped;
                if (!cont.IsWrapped(out isWrapped))
                {
                    //throw new ExceptionGlyph("Glyph","ValidateSimpContWrap",null);
                    return(StatusGV.TypeStatusExec.Aborted);
                }
                if (isWrapped)
                {
                    pozsContWrap.Add(pozCont);
                }
            }
            int numCont = pozsContWrap.Count;

            if (numCont != 0)
            {
                int[] indsKnotStart = new int[numCont];
                for (int iCont = 0; iCont < numCont; iCont++)
                {
                    int pozCont = (int)pozsContWrap[iCont];
                    indsKnotStart[iCont] = this.Outl.ContourByPoz(pozCont).IndKnotStart;
                }
                GErr gerr = new GErrContWrap(this.index, indsKnotStart);
                gerrlist.Add(gerr);
                //this.isOrientDefined=false;
            }

            /*
             * else
             * {
             *  //this.isOrientDefined=true;
             * }
             */
            pozsContWrap.Clear();
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 15
0
        internal StatusGV.TypeStatusExec ValidateSimpContMisor(GErrList gerrlist)
        {
            if ((this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContDupl].StatusRes !=
                 StatusGV.TypeStatusRes.NoErrors) ||
                (this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContWrap].StatusRes !=
                 StatusGV.TypeStatusRes.NoErrors) ||
                (this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContInters].StatusRes !=
                 StatusGV.TypeStatusRes.NoErrors))
            {
                return(StatusGV.TypeStatusExec.UnableToExec);
            }
            if (this.outl == null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpContMisor",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            ArrayList pozsContMisor = new ArrayList();

            for (int pozCont = 0; pozCont < this.outl.NumCont; pozCont++)
            {
                Contour cont = this.outl.ContourByPoz(pozCont);
                bool    isMisoriented;
                if (!cont.IsMisoriented(this.outl, out isMisoriented))
                {
                    throw new ExceptionGlyph("Glyph", "ValidateSimpContMisor", null);
                    //return StatusGV.TypeStatusExec.Aborted;
                }
                if (isMisoriented)
                {
                    pozsContMisor.Add(pozCont);
                }
            }

            int numCont = pozsContMisor.Count;

            if (numCont != 0)
            {
                int[] indsKnotStart = new int[numCont];
                for (int iCont = 0; iCont < numCont; iCont++)
                {
                    int pozCont = (int)pozsContMisor[iCont];
                    indsKnotStart[iCont] = this.Outl.ContourByPoz(pozCont).IndKnotStart;
                }
                GErr gerr = new GErrContMisor(this.index, indsKnotStart);
                gerrlist.Add(gerr);
            }
            pozsContMisor.Clear();
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        internal StatusGV.TypeStatusExec ValidateSimpKnotDupl(GErrList gerrlist)
        {
            ListPairInt infosKnotDupl = new ListPairInt();

            for (int pozCont = 0; pozCont < this.outl.NumCont; pozCont++)
            {
                Contour cont = this.outl.ContourByPoz(pozCont);
                cont.KnotDupl(infosKnotDupl);
            }
            if (infosKnotDupl.Count != 0)
            {
                GErr gerr = new GErrKnotDupl(this.index, infosKnotDupl);
                gerrlist.Add(gerr);
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 18
0
        /*
         *        METHODS: clear
         */

        internal void ClearByGV(int indGlyph, DefsGV.TypeGV typeGV)
        {
            GErrList gerrlist = this.gerrlists[indGlyph] as GErrList;

            if (gerrlist == null)
            {
                return;
            }
            for (int poz = gerrlist.Length - 1; poz >= 0; poz--)
            {
                GErr gerr = gerrlist[poz];
                if (GErrSign.DICFunc_IsSignedBy(gerr, typeGV) &&
                    GErrSign.DICFunc_IsSignedBy(gerr, indGlyph))
                {
                    this.DIAFunc_DeleteFromPool(gerr);
                }
            }
        }
Ejemplo n.º 19
0
        internal StatusGV.TypeStatusExec ValidateCompComponentInters(GErrList gerrlist)
        {
            ArrayList arrLinters = new ArrayList();

            if ((this.comp == null) || (this.outl == null))
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompComponentInters",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            int numComponent = this.comp.NumComponent;

            for (int pozComponentA = 0; pozComponentA < numComponent - 1; pozComponentA++)
            {
                Component componentA = this.comp.ComponentByPoz(pozComponentA);
                for (int pozComponentB = pozComponentA + 1; pozComponentB < numComponent; pozComponentB++)
                {
                    ListInfoInters linters    = new ListInfoInters();
                    Component      componentB = this.comp.ComponentByPoz(pozComponentB);
                    bool           areDuplicated;
                    this.outl.AreDuplicatedComponents(componentA, componentB, out areDuplicated);
                    if (areDuplicated)
                    {
                        continue;
                    }
                    this.outl.IntersectComponents(componentA, componentB, linters);

                    if (linters.Count != 0)
                    {
                        linters.SetIndGlyphComponent(componentA.IndexGlyphComponent,
                                                     componentB.IndexGlyphComponent);
                        arrLinters.Add(linters);
                    }
                }
            }
            if (arrLinters.Count != 0)
            {
                GErr gerr = new GErrComponentInters(this.index, arrLinters);
                gerrlist.Add(gerr);
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 20
0
        // return value: whether the list contains at least one "true" item
        public bool FilterByCond(DICond dic, GErrList gerrlist)
        {
            if (dic == null)
            {
                throw new ExceptionGlyph("GErrList", "FilterByCondition", "Null argument");
            }
            bool res = false;

            foreach (GErr gerr in this.gerrs)
            {
                if (dic(gerr))
                {
                    if (gerrlist != null)
                    {
                        gerrlist.Add(gerr);
                        res = true;
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 21
0
        public bool Inform(int indGlyph, DIAction diaToApply)
        {
            bool bRet = true;

            if (indGlyph == GConsts.IND_ALL)
            {
                this.InformAll(diaToApply);
                bRet = true;
            }
            else
            {
                GErrList gerrlist = this.gerrlists[indGlyph] as GErrList;
                if (gerrlist != null)
                {
                    //If some error is of type Error or AppError, then return false
                    bRet &= gerrlist.TestErrors();
                    gerrlist.ApplyToEach(diaToApply);
                }
            }
            return(bRet);
        }
Ejemplo n.º 22
0
        internal StatusGV.TypeStatusExec ValidateCompBBox(GErrList gerrlist)
        {
            if ((this.bbox == null) || (this.outl == null))
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompBBox",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            BoxD bboxCP;        // bbox for the control points

            bboxCP = this.outl.BBoxCP;
            if (!this.bbox.Equals(bboxCP))
            {
                double deviation   = this.bbox.DeviationMax(bboxCP);
                bool   toSkipError = ((this.outl.IsChangedByRound) && (Math.Abs(deviation) <= 1.0));
                if (!toSkipError)
                {
                    GErrBBox gerrBbox = new GErrBBox(this.IndexGlyph,
                                                     this.typeGlyph,
                                                     this.bbox, bboxCP);
                    gerrlist.Add(gerrBbox);
                }
            }

            BoxD bboxOutl;        // bbox for Outline

            bboxOutl = this.outl.BBox;
            //bboxOutline.SetEnlargeFU();
            if (!bboxOutl.Equals(bboxCP))
            {
                // warning
                GErrExtremeNotOnCurve gerrExtreme = new
                                                    GErrExtremeNotOnCurve(this.IndexGlyph,
                                                                          this.typeGlyph, bboxCP, bboxOutl);
                gerrlist.Add(gerrExtreme);
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 23
0
        internal StatusGV.TypeStatusExec ValidateSimpContDupl(GErrList gerrlist)
        {
            if (this.outl == null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpContDupl",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }
            ListPairInt pairsIndKnotStart = new ListPairInt();

            for (int pozContA = 0; pozContA < this.outl.NumCont - 1; pozContA++)
            {
                Contour contA = this.outl.ContourByPoz(pozContA);
                for (int pozContB = pozContA + 1; pozContB < this.outl.NumCont; pozContB++)
                {
                    Contour contB = this.outl.ContourByPoz(pozContB);
                    bool    isDupl;
                    if (!contA.AreDuplicated(contB, out isDupl))
                    {
                        //throw new ExceptionGlyph("Glyph","ValidateSimpContDupl",null);
                        return(StatusGV.TypeStatusExec.Aborted);
                    }
                    if (isDupl)
                    {
                        pairsIndKnotStart.Add(this.outl.ContourByPoz(pozContA).IndKnotStart,
                                              this.outl.ContourByPoz(pozContB).IndKnotStart);
                    }
                }
            }
            if (pairsIndKnotStart.Count != 0)
            {
                GErr gerr = new GErrContDupl(this.index, pairsIndKnotStart);
                gerrlist.Add(gerr);
                //this.isOrientDefined=false;
            }
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 24
0
 internal StatusGV.TypeStatusExec ValidateSimpContWrap(GErrList gerrlist)
 {
     /*
      *        ASSUMPTION: determines only "fully" wrapped contours
      */
     if (this.outl==null)
     {
         //throw new ExceptionGlyph("Glyph","ValidateSimpContWrap",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
 
     ArrayList pozsContWrap=new ArrayList();
     for (int pozCont=0; pozCont<this.outl.NumCont; pozCont++)
     {
         Contour cont=this.outl.ContourByPoz(pozCont);
         bool isWrapped;
         if (!cont.IsWrapped(out isWrapped))
         {
             //throw new ExceptionGlyph("Glyph","ValidateSimpContWrap",null);
             return StatusGV.TypeStatusExec.Aborted;
         }
         if (isWrapped)
         {
             pozsContWrap.Add(pozCont);
         }
     }
     int numCont=pozsContWrap.Count;
     if (numCont!=0)
     {
         int[] indsKnotStart=new int[numCont];
         for (int iCont=0; iCont<numCont; iCont++)
         {
             int pozCont=(int)pozsContWrap[iCont];
             indsKnotStart[iCont]=this.Outl.ContourByPoz(pozCont).IndKnotStart;
         }
         GErr gerr=new GErrContWrap(this.index, indsKnotStart);
         gerrlist.Add(gerr);
         //this.isOrientDefined=false;
     }
     /*
     else
     {
         //this.isOrientDefined=true;
     }
     */
     pozsContWrap.Clear();
     return StatusGV.TypeStatusExec.Completed;
 }
Ejemplo n.º 25
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;
        }
Ejemplo n.º 26
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;        
        }
Ejemplo n.º 27
0
        private void CallGV(DefsGV.TypeGV typeGV)
        {
            /*
             *        TRY/CATCH function
             */

            /*
             *        MEANING:    UNCONDITIONAL call of action
             */

            GErrList gerrlist = null;

            try
            {
                this.statusGV[(int)typeGV].StatusExec = StatusGV.TypeStatusExec.Aborted;
                this.statusGV[(int)typeGV].StatusRes  = StatusGV.TypeStatusRes.Undef;
                gerrlist = new GErrList();

                if (DefsGV.IsModifier(typeGV))
                {
                    this.fm.OnGM(this.index, DefsGM.From(typeGV), true);
                }

                // check that pre-required tests are performed
                if (!this.CanBeExec(typeGV))
                {
                    this.statusGV[(int)typeGV].StatusExec =
                        StatusGV.TypeStatusExec.UnableToExec;
                }

                // call Validate.. function
                System.Exception excValidation = null;
                if (this.statusGV[(int)typeGV].StatusExec !=
                    StatusGV.TypeStatusExec.UnableToExec)
                {
                    try
                    {
                        string     strTypeCV  = Enum.GetName(typeof(DefsGV.TypeGV), typeGV);
                        MethodInfo infoMethod = this.GetType().GetMethod(strTypeCV,
                                                                         System.Reflection.BindingFlags.Instance |
                                                                         System.Reflection.BindingFlags.NonPublic);
                        if (infoMethod != null)
                        {
                            object[] pars = { gerrlist };

                            // statusGV can be set to:
                            // Completed || UnableToExec || Aborted
                            try
                            {
                                this.statusGV[(int)typeGV].StatusExec = (StatusGV.TypeStatusExec)
                                                                        infoMethod.Invoke(this, pars);
                            }
                            catch (System.Reflection.TargetInvocationException TIException)
                            {
                                throw TIException.InnerException;
                            }

                            GErrSign.Sign(gerrlist, typeGV, this.index);
                        }
                        if (this.statusGV[(int)typeGV].StatusExec ==
                            StatusGV.TypeStatusExec.Completed)
                        {
                            this.statusGV[(int)typeGV].StatusRes =
                                gerrlist.StatusResGV(typeGV);
                        }
                    }
                    catch (System.Exception exc)
                    {
                        excValidation = exc;
                        this.statusGV[(int)typeGV].StatusExec =
                            StatusGV.TypeStatusExec.Aborted;
                    }
                }

                if (this.statusGV[(int)typeGV].StatusExec !=
                    StatusGV.TypeStatusExec.Completed)
                {
                    this.CleanUpOnNonCompletedGV(typeGV);
                    GErrValidation gerrVal = new GErrValidation(this.index,
                                                                this.typeGlyph,
                                                                typeGV,
                                                                this.statusGV[(int)typeGV].StatusExec,
                                                                excValidation);
                    gerrlist.Add(gerrVal);
                }

                GErrSign.Sign(gerrlist, typeGV, this.index);
                this.fm.OnGV(this.index, typeGV, gerrlist);
                gerrlist.ClearRelease();
            }

            catch (Exception excManagement) // exception thrown by the fm management structures
            {
                this.statusGV[(int)typeGV].StatusExec =
                    StatusGV.TypeStatusExec.Aborted;
                this.CleanUpOnNonCompletedGV(typeGV);    // T/C function
                GErrValidation gerrVal = new GErrValidation(this.index,
                                                            this.typeGlyph,
                                                            typeGV,
                                                            StatusGV.TypeStatusExec.Aborted,
                                                            excManagement);
                this.fm.ReportFailure(gerrVal);            // T/C function
                if (gerrlist != null)
                {
                    try { gerrlist.ClearRelease(); }
                    catch (Exception) {}
                }
            }
        }
Ejemplo n.º 28
0
        /*
         *        METHODS    :    VALIDATORS CONTENT
         *
         */

        internal StatusGV.TypeStatusExec ValidateSimpBBox(GErrList gerrlist)
        {
            if ((this.bbox==null)||(this.outl==null))
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpBBox",null);
                return StatusGV.TypeStatusExec.Aborted;    
            }
            BoxD bboxCP;        // bbox for the control points
            bboxCP=this.outl.BBoxCP;
            if (!bbox.Equals(bboxCP))
            {
                GErrBBox gerrBbox=new GErrBBox(this.IndexGlyph,
                    this.typeGlyph,
                    this.bbox,bboxCP);
                gerrlist.Add(gerrBbox);
            }
            BoxD bboxOutl;        // bbox for Outline
            bboxOutl=this.outl.BBox;
            //bboxOutline.SetEnlargeFU();
            if (!bboxOutl.Equals(bboxCP))
            {
                // warning
                GErrExtremeNotOnCurve gerrExtreme=new 
                    GErrExtremeNotOnCurve(this.IndexGlyph,
                    this.typeGlyph,bboxCP,bboxOutl);
                gerrlist.Add(gerrExtreme);

            }
            return StatusGV.TypeStatusExec.Completed;
        }
Ejemplo n.º 29
0
     internal void OnGV(int indGlyph, DefsGV.TypeGV typeGV, GErrList gerrlist)
     {
         Glyph glyph=this.gStore.GGet(indGlyph);
         if (glyph==null)
         {
             throw new ExceptionGlyph("FManager","OnGV",null);
         }
         glyph.StatusVal(typeGV).IsValid=true;
 
         bool areValidAll=true;
         for (int iTest=0; iTest<DefsGV.NumTest; iTest++)
         { 
             if (!glyph.StatusVal((DefsGV.TypeGV)iTest).IsValid)
             {
                 areValidAll=false;
                 break;
             }
         }
         if (areValidAll)
         {
             this.indGM.Remove(indGlyph);
         }
         this.gerrPool.GErrListAdd(gerrlist);
     }
Ejemplo n.º 30
0
 // return value: whether the list contains at least one "true" item 
 public bool FilterByCond(DICond dic, GErrList gerrlist)
 {
     if (dic==null)
     {
         throw new ExceptionGlyph("GErrList","FilterByCondition","Null argument");
     }
     bool res=false;
     foreach (GErr gerr in this.gerrs)
     {
         if (dic(gerr))
         {
             if (gerrlist!=null)
             {
                 gerrlist.Add(gerr);
                 res=true;
             }
         }
     }
     return res;
 }
Ejemplo n.º 31
0
 internal StatusGV.TypeStatusExec ValidateSimpKnotDupl(GErrList gerrlist)
 {
     ListPairInt infosKnotDupl=new ListPairInt();
     for (int pozCont=0; pozCont<this.outl.NumCont; pozCont++)
     {
         Contour cont=this.outl.ContourByPoz(pozCont);
         cont.KnotDupl(infosKnotDupl);
     }
     if (infosKnotDupl.Count!=0)
     {
         GErr gerr=new GErrKnotDupl(this.index, infosKnotDupl);
         gerrlist.Add(gerr);
     }
     return StatusGV.TypeStatusExec.Completed;
 }
Ejemplo n.º 32
0
 /*
  *        METHODS PUBLIC: dumps 
  */
 
 public void GErrListAdd(GErrList gerrlist)
 {
     if (gerrlist==null)
         return;
     gerrlist.ApplyToEach(DIActionBuilder.DIA(this,"DIAFunc_AddToPool"));
 }
Ejemplo n.º 33
0
        internal StatusGV.TypeStatusExec ValidateCompBind(GErrList gerrlist)
        {
            /*
             *        ASSUMPTION: -    the glyph is composite and Comp is already
             *                        read
             *                    -    clears outline that is already
             *                        built in case of failure to load one
             *                        of components
             */
            if (this.outl!=null)
            {
                this.outl.ClearDestroy();
                this.outl=null;
            }

            GErr gerr;
            bool isCircular=this.fm.PathCompBind.Contains(this.index);
            if (isCircular)
            {
                int numGlyph=this.fm.PathCompBind.Count;
                int[] pathCompBind=new int[numGlyph+1];
                for (int iGlyph=0; iGlyph<numGlyph; iGlyph++)
                {
                    pathCompBind[iGlyph]=(int)this.fm.PathCompBind[iGlyph];
                }
                pathCompBind[numGlyph]=this.index;
                gerr=new GErrComponentCircularDependency(this.index,
                    this.index, pathCompBind);
                gerrlist.Add(gerr);
                this.fm.PathCompBind.Clear();
                return StatusGV.TypeStatusExec.Completed;
            }
            if (this.outl!=null)
            {
                this.outl.ClearReset();
                this.outl=null;
            }
            if (this.comp==null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompBind",null);
                return StatusGV.TypeStatusExec.Aborted;
            }
    
            this.fm.PathCompBind.Add(this.index);

            //throw new ArgumentOutOfRangeException();    


            if (this.comp.NumComponent==0)
            {
                this.outl=new Outline();
                gerr=new GErrComponentEmpty(this.index,GConsts.IND_UNDEFINED);
                gerrlist.Add(gerr);
                return StatusGV.TypeStatusExec.Completed;
            }

            foreach (Component component in this.comp)
            {
                int indGlyphComponent=component.IndexGlyphComponent;
                if ((indGlyphComponent<0)||(indGlyphComponent>=this.fm.FNumGlyph))
                {
                    gerr=new GErrComponentIndexGlyph(this.index,indGlyphComponent);
                    gerrlist.Add(gerr);
                    this.fm.PathCompBind.Clear();
                    if (this.outl!=null)
                    {
                        this.outl.ClearDestroy();
                        this.outl=null;
                    }
                    return StatusGV.TypeStatusExec.Completed;
                }
                Glyph glyphComponent=this.fm.GGet(indGlyphComponent);
                if (glyphComponent==null)
                {
                    gerr=new GErrComponentLoadFailure(this.index,indGlyphComponent);
                    gerrlist.Add(gerr);
                    this.fm.PathCompBind.Clear();
                    if (this.outl!=null)
                    {
                        this.outl.ClearDestroy();
                        this.outl=null;
                    }
                    return StatusGV.TypeStatusExec.Completed;
                }
                if (glyphComponent.typeGlyph==GConsts.TypeGlyph.Empty)
                {
                    gerr=new GErrComponentEmpty(this.index,indGlyphComponent);
                    gerrlist.Add(gerr);
                    continue;
                }
                else
                {
                    if (glyphComponent.Outl==null)
                    {
                        gerr=new GErrComponentLoadFailure(this.index,indGlyphComponent);
                        gerrlist.Add(gerr);
                        this.fm.PathCompBind.Clear();
                        if (this.outl!=null)
                        {
                            this.outl.ClearDestroy();
                            this.outl=null;
                        }
                        return StatusGV.TypeStatusExec.Completed;
                    }
                }

                if (this.outl==null)
                {
                    this.outl=new Outline();
                }
                ArrayList errsLoadComponent;

                if (!this.outl.LoadComponent(component, 
                    glyphComponent.outl, 
                    out errsLoadComponent))
                {
                    this.fm.PathCompBind.Clear();
                    if (this.outl!=null)
                    {
                        this.outl.ClearDestroy();
                        this.outl=null;
                    }
                    //throw new ExceptionGlyph("Glyph","ValidateCompBind",null);
                    return StatusGV.TypeStatusExec.Aborted;
                }
                if (errsLoadComponent!=null)
                {
                    foreach (Component.TypeErrLoadComponent errLoadComponent in errsLoadComponent)
                    {    
                        gerr=null;
                        switch (errLoadComponent)
                        {
                            case Component.TypeErrLoadComponent.IncorrectShiftSpecification:
                                gerr=new GErrComponentIncorrectShift(this.index,
                                    component.IndexGlyphComponent);
                                break;
                            case Component.TypeErrLoadComponent.IncorrectIndexKnotGlyph:
                                gerr=new GErrComponentIndexKnot(this.index,
                                    component.IndexGlyphComponent,
                                    component.IndexKnotAttGlyph,
                                    true);
                                break;
                            case Component.TypeErrLoadComponent.IncorrectIndexKnotComponent:
                                gerr=new GErrComponentIndexKnot(this.index,
                                    component.IndexGlyphComponent,
                                    component.IndexKnotAttComponent,
                                    false);
                                break;
                            case Component.TypeErrLoadComponent.IncorrectTransform:
                                gerr=new GErrComponentIncorrectTransform(this.index,
                                    component.IndexGlyphComponent,
                                    component.TrOTF2Dot14);
                                break;
                        }
                        gerrlist.Add(gerr);
                    }
                    if (this.outl!=null)
                    {
                        this.outl.ClearDestroy();
                        this.outl=null;
                    }
                    this.fm.PathCompBind.Clear();
                    return StatusGV.TypeStatusExec.Completed;
                }
            }
            this.fm.PathCompBind.RemoveAt(this.fm.PathCompBind.Count-1);
            return StatusGV.TypeStatusExec.Completed;
        }
Ejemplo n.º 34
0
        private void CallGV(DefsGV.TypeGV typeGV)
        {    
            /*
             *        TRY/CATCH function
             */

            /*
             *        MEANING:    UNCONDITIONAL call of action
             */

            GErrList gerrlist=null;
            try
            {
                this.statusGV[(int)typeGV].StatusExec=StatusGV.TypeStatusExec.Aborted;
                this.statusGV[(int)typeGV].StatusRes=StatusGV.TypeStatusRes.Undef;
                gerrlist=new GErrList();
            
                if (DefsGV.IsModifier(typeGV))
                {
                    this.fm.OnGM(this.index,DefsGM.From(typeGV),true);        
                }

                // check that pre-required tests are performed
                if (!this.CanBeExec(typeGV))
                {
                    this.statusGV[(int)typeGV].StatusExec=
                        StatusGV.TypeStatusExec.UnableToExec;
                }

                // call Validate.. function
                System.Exception excValidation=null;
                if (this.statusGV[(int)typeGV].StatusExec!=
                    StatusGV.TypeStatusExec.UnableToExec)
                {
                    try
                    {
                        string strTypeCV=Enum.GetName(typeof(DefsGV.TypeGV),typeGV);
                        MethodInfo infoMethod=this.GetType().GetMethod(strTypeCV, 
                            System.Reflection.BindingFlags.Instance|
                            System.Reflection.BindingFlags.NonPublic);
                        if (infoMethod!=null)
                        {
                            object[] pars={gerrlist};
                
                            // statusGV can be set to:
                            // Completed || UnableToExec || Aborted
                            try
                            {
                                this.statusGV[(int)typeGV].StatusExec=(StatusGV.TypeStatusExec)
                                    infoMethod.Invoke(this, pars);
                            }
                            catch(System.Reflection.TargetInvocationException TIException)
                            {
                                throw TIException.InnerException;
                            }

                            GErrSign.Sign(gerrlist, typeGV, this.index);
                        }
                        if (this.statusGV[(int)typeGV].StatusExec==
                            StatusGV.TypeStatusExec.Completed)
                        {
                            this.statusGV[(int)typeGV].StatusRes=
                                gerrlist.StatusResGV(typeGV);
                        }
                    }
                    catch (System.Exception exc)
                    {
                        excValidation=exc;
                        this.statusGV[(int)typeGV].StatusExec=
                            StatusGV.TypeStatusExec.Aborted;
                    }
                }

                if (this.statusGV[(int)typeGV].StatusExec!=
                    StatusGV.TypeStatusExec.Completed)
                {
                    this.CleanUpOnNonCompletedGV(typeGV);
                    GErrValidation gerrVal=new GErrValidation(this.index,
                        this.typeGlyph,
                        typeGV,
                        this.statusGV[(int)typeGV].StatusExec,
                        excValidation);
                    gerrlist.Add(gerrVal);
                }

                GErrSign.Sign(gerrlist,typeGV,this.index);
                this.fm.OnGV(this.index, typeGV, gerrlist);
                gerrlist.ClearRelease();
            }

            catch (Exception excManagement) // exception thrown by the fm management structures 
            {
                this.statusGV[(int)typeGV].StatusExec=
                    StatusGV.TypeStatusExec.Aborted;
                this.CleanUpOnNonCompletedGV(typeGV);    // T/C function
                GErrValidation gerrVal=new GErrValidation(this.index,
                    this.typeGlyph,
                    typeGV,
                    StatusGV.TypeStatusExec.Aborted,
                    excManagement);
                this.fm.ReportFailure(gerrVal);            // T/C function
                if (gerrlist!=null)
                {
                    try { gerrlist.ClearRelease(); }
                    catch (Exception) {}
                }
            }                        
        }
Ejemplo n.º 35
0
 internal StatusGV.TypeStatusExec ValidateSimpContDupl(GErrList gerrlist)
 {
     if (this.outl==null)
     {
         //throw new ExceptionGlyph("Glyph","ValidateSimpContDupl",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
     ListPairInt pairsIndKnotStart=new ListPairInt();
     for (int pozContA=0; pozContA<this.outl.NumCont-1; pozContA++)
     {
         Contour contA=this.outl.ContourByPoz(pozContA);
         for (int pozContB=pozContA+1; pozContB<this.outl.NumCont; pozContB++)
         {
             Contour contB=this.outl.ContourByPoz(pozContB);
             bool isDupl;
             if (!contA.AreDuplicated(contB, out isDupl))
             {
                 //throw new ExceptionGlyph("Glyph","ValidateSimpContDupl",null);
                 return StatusGV.TypeStatusExec.Aborted;
             }
             if (isDupl)
             {
                 pairsIndKnotStart.Add(this.outl.ContourByPoz(pozContA).IndKnotStart,
                     this.outl.ContourByPoz(pozContB).IndKnotStart);
             }
         }
     }
     if (pairsIndKnotStart.Count!=0)
     {
         GErr gerr=new GErrContDupl(this.index, pairsIndKnotStart);
         gerrlist.Add(gerr);
         //this.isOrientDefined=false;
     }
     return StatusGV.TypeStatusExec.Completed;
 }
Ejemplo n.º 36
0
 internal StatusGV.TypeStatusExec ValidateSimpContInters(GErrList gerrlist)
 {
     /*
      *        MEANING:    finds ALL intersections: 
      *                    including D0, D1 and S/I bezier
      */
     ListInfoInters linters = new ListInfoInters();
     if (this.outl==null)
     {
         //throw new ExceptionGlyph("Glyph","ValidateSimpContInters",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
     if (!this.outl.Intersect(linters))
     {
         //throw new ExceptionGlyph("Glyph","ValidateSimpContInters",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
     if (linters.Count>0)
     {
         GErr gerr=new GErrContInters(this.index, linters);
         gerrlist.Add(gerr);
         //this.isOrientDefined=false;
     }
     return StatusGV.TypeStatusExec.Completed;
 }
Ejemplo n.º 37
0
 internal StatusGV.TypeStatusExec ValidateCompComponentDupl(GErrList gerrlist)
 {
     ListPairInt pairsIndComponentDupl=new ListPairInt();
 
     if ((this.comp==null)||(this.outl==null))
     {
         //throw new ExceptionGlyph("Glyph","ValidateCompComponentDupl",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
     int numComponent=this.comp.NumComponent;
     for (int pozComponentA=0; pozComponentA<numComponent-1; pozComponentA++)
     {
         Component componentA=this.comp.ComponentByPoz(pozComponentA);
         for (int pozComponentB=pozComponentA+1; pozComponentB<numComponent; pozComponentB++)
         {
             ListInfoInters linters=new ListInfoInters();
             Component componentB=this.comp.ComponentByPoz(pozComponentB);
             bool areDuplicated;
             this.outl.AreDuplicatedComponents(componentA,componentB,out areDuplicated);
             if (areDuplicated)
             {
                 pairsIndComponentDupl.Add(componentA.IndexGlyphComponent,
                     componentB.IndexGlyphComponent);
             }
         }
     }
     if (pairsIndComponentDupl.Count!=0)
     {
         GErr gerr=new GErrComponentDupl(this.index, pairsIndComponentDupl);
         gerrlist.Add(gerr);
     }
     return StatusGV.TypeStatusExec.Completed;
 }
Ejemplo n.º 38
0
        internal StatusGV.TypeStatusExec ValidateSimpContMisor(GErrList gerrlist)
        {
            if ((this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContDupl].StatusRes!=
                StatusGV.TypeStatusRes.NoErrors)||
                (this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContWrap].StatusRes!=
                StatusGV.TypeStatusRes.NoErrors)||
                (this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContInters].StatusRes!=
                StatusGV.TypeStatusRes.NoErrors))
            {
                return StatusGV.TypeStatusExec.UnableToExec;
            }
            if (this.outl==null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateSimpContMisor",null);
                return StatusGV.TypeStatusExec.Aborted;
            }
            ArrayList pozsContMisor=new ArrayList();
            for (int pozCont=0; pozCont<this.outl.NumCont; pozCont++)
            {
                Contour cont=this.outl.ContourByPoz(pozCont);
                bool isMisoriented;
                if (!cont.IsMisoriented(this.outl, out isMisoriented))
                {
                    throw new ExceptionGlyph("Glyph","ValidateSimpContMisor",null);
                    //return StatusGV.TypeStatusExec.Aborted;
                }
                if (isMisoriented)
                {
                    pozsContMisor.Add(pozCont);
                }
            }

            int numCont=pozsContMisor.Count;
            if (numCont!=0)
            {
                int[] indsKnotStart=new int[numCont];
                for (int iCont=0; iCont<numCont; iCont++)
                {
                    int pozCont=(int)pozsContMisor[iCont];
                    indsKnotStart[iCont]=this.Outl.ContourByPoz(pozCont).IndKnotStart;
                }
                GErr gerr=new GErrContMisor(this.index, indsKnotStart);
                gerrlist.Add(gerr);
            }
            pozsContMisor.Clear();
            return StatusGV.TypeStatusExec.Completed;
        }
Ejemplo n.º 39
0
 internal StatusGV.TypeStatusExec ValidateCompComponentInters(GErrList gerrlist)
 {
     ArrayList arrLinters=new ArrayList();
     if ((this.comp==null)||(this.outl==null))
     {
         //throw new ExceptionGlyph("Glyph","ValidateCompComponentInters",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
     int numComponent=this.comp.NumComponent;
     for (int pozComponentA=0; pozComponentA<numComponent-1; pozComponentA++)
     {
         Component componentA=this.comp.ComponentByPoz(pozComponentA);
         for (int pozComponentB=pozComponentA+1; pozComponentB<numComponent; pozComponentB++)
         {
             ListInfoInters linters=new ListInfoInters();
             Component componentB=this.comp.ComponentByPoz(pozComponentB);
             bool areDuplicated;
             this.outl.AreDuplicatedComponents(componentA,componentB,out areDuplicated);
             if (areDuplicated)
                 continue;
             this.outl.IntersectComponents(componentA, componentB, linters);
     
             if (linters.Count!=0)
             {
                 linters.SetIndGlyphComponent(componentA.IndexGlyphComponent,
                     componentB.IndexGlyphComponent);
                 arrLinters.Add(linters);
             }
         }
     }
     if (arrLinters.Count!=0)
     {
         GErr gerr=new GErrComponentInters(this.index, arrLinters);
         gerrlist.Add(gerr);
     }
     return StatusGV.TypeStatusExec.Completed;
 }
Ejemplo n.º 40
0
        internal StatusGV.TypeStatusExec ValidateCompBind(GErrList gerrlist)
        {
            /*
             *        ASSUMPTION: -    the glyph is composite and Comp is already
             *                        read
             *                    -    clears outline that is already
             *                        built in case of failure to load one
             *                        of components
             */
            if (this.outl != null)
            {
                this.outl.ClearDestroy();
                this.outl = null;
            }

            GErr gerr;
            bool isCircular = this.fm.PathCompBind.Contains(this.index);

            if (isCircular)
            {
                int   numGlyph     = this.fm.PathCompBind.Count;
                int[] pathCompBind = new int[numGlyph + 1];
                for (int iGlyph = 0; iGlyph < numGlyph; iGlyph++)
                {
                    pathCompBind[iGlyph] = (int)this.fm.PathCompBind[iGlyph];
                }
                pathCompBind[numGlyph] = this.index;
                gerr = new GErrComponentCircularDependency(this.index,
                                                           this.index, pathCompBind);
                gerrlist.Add(gerr);
                this.fm.PathCompBind.Clear();
                return(StatusGV.TypeStatusExec.Completed);
            }
            if (this.outl != null)
            {
                this.outl.ClearReset();
                this.outl = null;
            }
            if (this.comp == null)
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompBind",null);
                return(StatusGV.TypeStatusExec.Aborted);
            }

            this.fm.PathCompBind.Add(this.index);

            //throw new ArgumentOutOfRangeException();


            if (this.comp.NumComponent == 0)
            {
                this.outl = new Outline();
                gerr      = new GErrComponentEmpty(this.index, GConsts.IND_UNDEFINED);
                gerrlist.Add(gerr);
                return(StatusGV.TypeStatusExec.Completed);
            }

            foreach (Component component in this.comp)
            {
                int indGlyphComponent = component.IndexGlyphComponent;
                if ((indGlyphComponent < 0) || (indGlyphComponent >= this.fm.FNumGlyph))
                {
                    gerr = new GErrComponentIndexGlyph(this.index, indGlyphComponent);
                    gerrlist.Add(gerr);
                    this.fm.PathCompBind.Clear();
                    if (this.outl != null)
                    {
                        this.outl.ClearDestroy();
                        this.outl = null;
                    }
                    return(StatusGV.TypeStatusExec.Completed);
                }
                Glyph glyphComponent = this.fm.GGet(indGlyphComponent);
                if (glyphComponent == null)
                {
                    gerr = new GErrComponentLoadFailure(this.index, indGlyphComponent);
                    gerrlist.Add(gerr);
                    this.fm.PathCompBind.Clear();
                    if (this.outl != null)
                    {
                        this.outl.ClearDestroy();
                        this.outl = null;
                    }
                    return(StatusGV.TypeStatusExec.Completed);
                }
                if (glyphComponent.typeGlyph == GConsts.TypeGlyph.Empty)
                {
                    gerr = new GErrComponentEmpty(this.index, indGlyphComponent);
                    gerrlist.Add(gerr);
                    continue;
                }
                else
                {
                    if (glyphComponent.Outl == null)
                    {
                        gerr = new GErrComponentLoadFailure(this.index, indGlyphComponent);
                        gerrlist.Add(gerr);
                        this.fm.PathCompBind.Clear();
                        if (this.outl != null)
                        {
                            this.outl.ClearDestroy();
                            this.outl = null;
                        }
                        return(StatusGV.TypeStatusExec.Completed);
                    }
                }

                if (this.outl == null)
                {
                    this.outl = new Outline();
                }
                ArrayList errsLoadComponent;

                if (!this.outl.LoadComponent(component,
                                             glyphComponent.outl,
                                             out errsLoadComponent))
                {
                    this.fm.PathCompBind.Clear();
                    if (this.outl != null)
                    {
                        this.outl.ClearDestroy();
                        this.outl = null;
                    }
                    //throw new ExceptionGlyph("Glyph","ValidateCompBind",null);
                    return(StatusGV.TypeStatusExec.Aborted);
                }
                if (errsLoadComponent != null)
                {
                    foreach (Component.TypeErrLoadComponent errLoadComponent in errsLoadComponent)
                    {
                        gerr = null;
                        switch (errLoadComponent)
                        {
                        case Component.TypeErrLoadComponent.IncorrectShiftSpecification:
                            gerr = new GErrComponentIncorrectShift(this.index,
                                                                   component.IndexGlyphComponent);
                            break;

                        case Component.TypeErrLoadComponent.IncorrectIndexKnotGlyph:
                            gerr = new GErrComponentIndexKnot(this.index,
                                                              component.IndexGlyphComponent,
                                                              component.IndexKnotAttGlyph,
                                                              true);
                            break;

                        case Component.TypeErrLoadComponent.IncorrectIndexKnotComponent:
                            gerr = new GErrComponentIndexKnot(this.index,
                                                              component.IndexGlyphComponent,
                                                              component.IndexKnotAttComponent,
                                                              false);
                            break;

                        case Component.TypeErrLoadComponent.IncorrectTransform:
                            gerr = new GErrComponentIncorrectTransform(this.index,
                                                                       component.IndexGlyphComponent,
                                                                       component.TrOTF2Dot14);
                            break;
                        }
                        gerrlist.Add(gerr);
                    }
                    if (this.outl != null)
                    {
                        this.outl.ClearDestroy();
                        this.outl = null;
                    }
                    this.fm.PathCompBind.Clear();
                    return(StatusGV.TypeStatusExec.Completed);
                }
            }
            this.fm.PathCompBind.RemoveAt(this.fm.PathCompBind.Count - 1);
            return(StatusGV.TypeStatusExec.Completed);
        }
Ejemplo n.º 41
0
        internal StatusGV.TypeStatusExec ValidateCompBBox(GErrList gerrlist)
        {
            if ((this.bbox==null)||(this.outl==null))
            {
                //throw new ExceptionGlyph("Glyph","ValidateCompBBox",null);
                return StatusGV.TypeStatusExec.Aborted;    
            }
            BoxD bboxCP;        // bbox for the control points
            bboxCP=this.outl.BBoxCP;
            if (!this.bbox.Equals(bboxCP))
            {
                double deviation=this.bbox.DeviationMax(bboxCP);
                bool toSkipError=((this.outl.IsChangedByRound)&&(Math.Abs(deviation)<=1.0));
                if (!toSkipError)
                {    
                    GErrBBox gerrBbox=new GErrBBox(this.IndexGlyph,
                        this.typeGlyph,
                        this.bbox,bboxCP);
                    gerrlist.Add(gerrBbox);
                }
            }

            BoxD bboxOutl;        // bbox for Outline
            bboxOutl=this.outl.BBox;
            //bboxOutline.SetEnlargeFU();
            if (!bboxOutl.Equals(bboxCP))
            {
                // warning
                GErrExtremeNotOnCurve gerrExtreme=new 
                    GErrExtremeNotOnCurve(this.IndexGlyph,
                    this.typeGlyph,bboxCP,bboxOutl);
                gerrlist.Add(gerrExtreme);

            }
            return StatusGV.TypeStatusExec.Completed;
        }
Ejemplo n.º 42
0
 internal StatusGV.TypeStatusExec ValidateSimpContDegen(GErrList gerrlist)
 {
     ArrayList listIndsKnotStart=new ArrayList();
     for (int pozCont=0; pozCont<this.outl.NumCont; pozCont++)
     {
         Contour cont=this.outl.ContourByPoz(pozCont);
         if (cont.IsDegen)
         {
             listIndsKnotStart.Add(cont.IndKnotStart);
         }
     }
     int numCont=listIndsKnotStart.Count;
     if (numCont!=0)
     {
         int[] indsKnotStart=new int[numCont];
         for (int iCont=0; iCont<numCont; iCont++)
         {
             indsKnotStart[iCont]=(int)listIndsKnotStart[iCont];
         }
         GErr gerr=new GErrContDegen(this.index, indsKnotStart);
         gerrlist.Add(gerr);
     }
     return StatusGV.TypeStatusExec.Completed;
 }