Exemplo n.º 1
0
 private bool IsStretch(Node node)
 {
     try
     {
         if (node.attrs != null)
         {
             Nodes.Attribute attribute = node.attrs.Get("stretchy");
             if ((attribute != null) && !Convert.ToBoolean(attribute.val))
             {
                 return(false);
             }
         }
     }
     catch
     {
     }
     if ((((node.firstChild == null) || (node.firstChild.type_.type != ElementType.Entity)) ||
          (node.firstChild.glyph == null)) ||
         ((((node.firstChild.glyph.Code != "021C0") && (node.firstChild.glyph.Code != "021C1")) &&
           ((node.firstChild.glyph.Code != "021BC") && (node.firstChild.glyph.Code != "021BD"))) &&
          ((((node.firstChild.glyph.Code != "02192") && (node.firstChild.glyph.Code != "02190")) &&
            ((node.firstChild.glyph.Code != "02194") && (node.firstChild.glyph.Code != "000AF"))) &&
           ((node.firstChild.glyph.Code != "0FE38") && (node.firstChild.glyph.Code != "00332")))))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
        private bool IsStretchyRec(Node node)
        {
            bool r          = false;
            Node target     = null;
            Node firstChild = null;

            if (node.type_.type == ElementType.Mrow)
            {
                if ((node.numChildren == 1) && (node.firstChild.type_.type == ElementType.Mo))
                {
                    firstChild = node.firstChild;
                }
            }
            else if (node.type_.type == ElementType.Mo)
            {
                firstChild = node;
            }
            if (firstChild != null)
            {
                if ((firstChild.numChildren == 1) && (firstChild.firstChild.type_.type == ElementType.Entity))
                {
                    target = firstChild.firstChild;
                }
                try
                {
                    if (node.attrs != null)
                    {
                        Nodes.Attribute attribute = node.attrs.Get("stretchy");
                        if ((attribute != null) && !Convert.ToBoolean(attribute.val))
                        {
                            return(false);
                        }
                    }
                }
                catch
                {
                }
            }
            if ((target == null) || (target.glyph == null))
            {
                return(r);
            }
            string code = target.glyph.Code;

            if ((((code != "0F578") && (code != "0F577")) && ((code != "0F576") && (code != "021C4"))) && (((code != "021C6") && (code != "021CC")) && (code != "021CB")))
            {
                return(r);
            }
            return(true);
        }
Exemplo n.º 3
0
        private bool IsHarpoon(Node node)
        {
            Node entity = null;
            Node op     = null;

            if (node.type_.type == ElementType.Mrow)
            {
                if ((node.numChildren == 1) && (node.firstChild.type_.type == ElementType.Mo))
                {
                    op = node.firstChild;
                }
            }
            else if (node.type_.type == ElementType.Mo)
            {
                op = node;
            }
            if (op != null)
            {
                if ((op.numChildren == 1) && (op.firstChild.type_.type == ElementType.Entity))
                {
                    entity = op.firstChild;
                }
                try
                {
                    if (node.attrs != null)
                    {
                        Nodes.Attribute attribute = node.attrs.Get("stretchy");
                        if ((attribute != null) && !Convert.ToBoolean(attribute.val))
                        {
                            return(false);
                        }
                    }
                }
                catch
                {
                }
            }
            if ((entity == null) || (entity.glyph == null))
            {
                return(false);
            }
            string g = entity.glyph.Code;

            if ((((g != "0F578") && (g != "0F577")) && ((g != "0F576") && (g != "021C4"))) &&
                (((g != "021C6") && (g != "021CC")) && (g != "021CB")))
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 4
0
 //
 private void PropogateAttributes (Node trNode1, Node trNode2)
 {
     try
     {
         if ((trNode1.type_.type != ElementType.Mtr) ||
             (trNode2.type_.type != ElementType.Mtr))
         {
             return;
         }
         NodesList list1 = trNode1.GetChildrenNodes ();
         NodesList list2 = trNode2.GetChildrenNodes ();
         if (list1.Count != list2.Count)
         {
             return;
         }
         for (int i = 0; i < list1.Count; i++)
         {
             if (i < list2.Count)
             {
                 Node child1 = list1.Get (i);
                 Node child2 = list2.Get (i);
                 if (child1.attrs != null)
                 {
                     child1.attrs.Reset ();
                     try
                     {
                         for (int j = 0; j < child1.attrs.Count; j++)
                         {
                             Nodes.Attribute attr1 = child1.attrs.Next ();
                             Nodes.Attribute attr2 = new Nodes.Attribute (attr1.name, attr1.val, attr1.ns);
                             if (child2.attrs == null)
                             {
                                 child2.attrs = new AttributeList ();
                             }
                             child2.attrs.Add (attr2);
                         }
                     }
                     catch
                     {
                     }
                     child1.attrs.Reset ();
                     if (child2.attrs != null)
                     {
                         child2.attrs.Reset ();
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }