예제 #1
0
 // methods
 public bool GAdd(Glyph glyph)
 {
     if (glyph==null)
     {
         throw new ExceptionGlyph("GStore","GAdd","Null argument");
     }
     if (glyph.IndexGlyph==GConsts.IND_UNINITIALIZED)
     {
         throw new ExceptionGlyph("GStore","GAdd",null);
     }
     this.glyphs[glyph.IndexGlyph]=glyph;
     return true;
 }
예제 #2
0
 // members
 override public void ClearRelease()
 {
     this.glyph=null;
 }
예제 #3
0
 // constructors
 public DrawParamGErr(Glyph glyph)
     : base(null,0)
 {
     this.glyph=glyph;
 }
예제 #4
0
 /*
  *        METHODS: glyph access
  */
 public Glyph GGet(int indGlyph)
 {
     if ((0>indGlyph)||(indGlyph>=this.FNumGlyph))
         return null;
     Glyph glyph=this.gStore.GGet(indGlyph);
     if (glyph==null)
     {
         glyph=new Glyph(indGlyph,this);
         this.gStore.GAdd(glyph);
         glyph.GResetFromSource();    
     }
     return glyph;
 }
예제 #5
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);
        }
예제 #6
0
        /*
         *        METHODS: UPDATES
         */
        internal void OnGM(int indGlyph, DefsGM.TypeGM typeGM, bool isCaller)
        {
            Glyph glyph = this.gStore.GGet(indGlyph);

            if ((isCaller) && (glyph == null))
            {
                throw new ExceptionGlyph("FManager", "OnGM", "Null argument");
            }
            ArrayList arrCompDep = this.grel.GetCompDep(indGlyph);

            if (arrCompDep != null)
            {
                foreach (int indCompDep in arrCompDep)
                {
                    this.OnGM(indCompDep, typeGM, false);
                }
            }

            /*
             *        IN ANY CASE
             */
            // clear self-errors on SourceValidator
            if (isCaller && DefsGM.IsSourceValidator(typeGM))
            {
                this.gerrPool.ClearByGV(indGlyph, DefsGV.From(typeGM));
            }

            //    INVALIDATION TABLE:
            //
            //                            Itself              Dependents
            //                       VSrc VBind VPure     VSrc VBind VPure
            //
            //    Validator SOURCE    No     Yes   Yes       No      Yes   Yes
            //
            //    Validator BINDING    No     No       Yes       No   Yes   Yes
            //
            //    MODIFIER PURE        Yes  Yes   Yes       Yes  Yes   Yes
            //                      |                     |
            //                        BUT: does not clear errors
            //                             VSrc clears its errors by itself

            if (DefsGM.IsSourceValidator(typeGM))
            {
                //    ValidateTypeGlyphSource
                //    ValidateSimpSource
                //    ValidateCompBind
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        // invalidate & clear errors
                        if (DefsGV.IsSourceValidator(typeGV))
                        {
                            continue;
                        }
                        glyph.StatusVal(typeGV).IsValid = false;
                        this.gerrPool.ClearByGV(indGlyph, typeGV);
                    }
                }
            }
            else if (typeGM == DefsGM.TypeGM.ValidateCompBind)
            {
                //    ValidateCompBind
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        if (DefsGV.IsSourceValidator(typeGV))
                        {
                            continue;
                        }
                        if (isCaller && (typeGV == DefsGV.TypeGV.ValidateCompBind))
                        {
                            continue;
                        }
                        glyph.StatusVal(typeGV).IsValid = false;
                        this.gerrPool.ClearByGV(indGlyph, typeGV);
                    }
                }
            }
            else
            {
                // Pure Modifier
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        glyph.StatusVal(typeGV).IsValid = false;
                        if (!DefsGV.IsSourceValidator(typeGV))
                        {
                            this.gerrPool.ClearByGV(indGlyph, typeGV);
                        }
                    }
                }
            }
            if (!this.indGM.Contains(indGlyph))
            {
                this.indGM.Add(indGlyph);
            }
        }