Exemplo n.º 1
0
 public OverBar(Box box, double kern, double thickness)
     : base()
 {
     Add(new StrutBox(0, thickness, 0, 0));
     Add(new HorizontalRule(thickness, box.Width, 0));
     Add(new StrutBox(0, kern, 0, 0));
     Add(box);
 }
Exemplo n.º 2
0
        public override void Add(Box box)
        {
            base.Add(box);

            childBoxesTotalWidth += box.Width;
            this.Width = Math.Max(this.Width, childBoxesTotalWidth);
            this.Height = Math.Max((this.Children.Count == 0 ? double.NegativeInfinity : Height), box.Height - box.Shift);
            this.Depth = Math.Max((this.Children.Count == 0 ? double.NegativeInfinity : Depth), box.Depth + box.Shift);
        }
Exemplo n.º 3
0
        public override void Add(Box box)
        {
            base.Add(box);

            if (this.Children.Count == 1)
            {
                this.Height = box.Height;
                this.Depth = box.Depth;
            }
            else
            {
                this.Depth += box.Height + box.Depth;
            }
            RecalculateWidth(box);
        }
Exemplo n.º 4
0
        public override void Add(int position, Box box)
        {
            base.Add(position, box);

            if (position == 0)
            {
                this.Depth += box.Depth + Height;
                this.Height = box.Height;
            }
            else
            {
                this.Depth += box.Height + box.Depth;
            }
            RecalculateWidth(box);
        }
Exemplo n.º 5
0
        public OverUnderBox(Box baseBox, Box delimeterBox, Box scriptBox, double kern, bool over)
            : base()
        {
            this.BaseBox = baseBox;
            this.DelimeterBox = delimeterBox;
            this.ScriptBox = scriptBox;
            this.Kern = kern;
            this.Over = over;

            // Calculate dimensions of box.
            this.Width = baseBox.Width;
            this.Height = baseBox.Height + (over ? delimeterBox.Width : 0) +
                (over && scriptBox != null ? scriptBox.Height + scriptBox.Depth + kern : 0);
            this.Depth = baseBox.Depth + (over ? 0 : delimeterBox.Width) +
                (!over && scriptBox == null ? 0 : scriptBox.Height + scriptBox.Depth + kern);
        }
Exemplo n.º 6
0
 public HorizontalBox(Box box, double width, TexAlignment alignment)
     : this()
 {
     var extraWidth = width - box.Width;
     if (alignment == TexAlignment.Center)
     {
         var strutBox = new StrutBox(extraWidth / 2, 0, 0, 0);
         Add(strutBox);
         Add(box);
         Add(strutBox);
     }
     else if (alignment == TexAlignment.Left)
     {
         Add(box);
         Add(new StrutBox(extraWidth, 0, 0, 0));
     }
     else if (alignment == TexAlignment.Right)
     {
         Add(new StrutBox(extraWidth, 0, 0, 0));
         Add(box);
     }
 }
Exemplo n.º 7
0
 public VerticalBox(Box box, double rest, TexAlignment alignment)
     : this()
 {
     Add(box);
     if (alignment == TexAlignment.Center)
     {
         var strutBox = new StrutBox(0, rest / 2, 0, 0);
         base.Add(0, strutBox);
         this.Height += rest / 2;
         this.Depth += rest / 2;
         base.Add(strutBox);
     }
     else if (alignment == TexAlignment.Top)
     {
         this.Depth += rest;
         base.Add(new StrutBox(0, rest, 0, 0));
     }
     else if (alignment == TexAlignment.Bottom)
     {
         this.Height += rest;
         base.Add(0, new StrutBox(0, rest, 0, 0));
     }
 }
Exemplo n.º 8
0
 private void RecalculateWidth(Box box)
 {
     this.leftMostPos = Math.Min(leftMostPos, box.Shift);
     this.rightMostPos = Math.Max(rightMostPos, box.Shift + (box.Width > 0 ? box.Width : 0));
     this.Width = rightMostPos - leftMostPos;
 }
Exemplo n.º 9
0
 public HorizontalBox(Box box)
     : this()
 {
     Add(box);
 }
Exemplo n.º 10
0
 public virtual void Add(int position, Box box)
 {
     this.children.Insert(position, box);
 }
Exemplo n.º 11
0
 private static Box ChangeWidth(Box box, double maxWidth)
 {
     if (box != null && Math.Abs(maxWidth - box.Width) > TexUtilities.FloatPrecision)
         return new HorizontalBox(box, maxWidth, TexAlignment.Center);
     else
         return box;
 }
Exemplo n.º 12
0
Arquivo: Box.cs Projeto: Civa/Zenith
 public virtual void Add(int position, Box box)
 {
     this.children.Insert(position, box);
 }
Exemplo n.º 13
0
Arquivo: Box.cs Projeto: Civa/Zenith
 public virtual void Add(Box box)
 {
     this.children.Add(box);
 }
Exemplo n.º 14
0
 private void RecalculateWidth(Box box)
 {
     this.leftMostPos  = Math.Min(leftMostPos, box.Shift);
     this.rightMostPos = Math.Max(rightMostPos, box.Shift + (box.Width > 0 ? box.Width : 0));
     this.Width        = rightMostPos - leftMostPos;
 }
Exemplo n.º 15
0
 private static Box ChangeWidth(Box box, double maxWidth)
 {
     // Centre specified box in new box of specified width, if necessary.
     if (Math.Abs(maxWidth - box.Width) > TexUtilities.FloatPrecision)
         return new HorizontalBox(box, maxWidth, TexAlignment.Center);
     else
         return box;
 }
Exemplo n.º 16
0
 private static void CentreBox(Box box, double axis)
 {
     var totalHeight = box.Height + box.Depth;
     box.Shift = -(totalHeight / 2 - box.Height) - axis;
 }
Exemplo n.º 17
0
 internal TexRenderer(Box box, double scale)
 {
     this.Box = box;
     this.Scale = scale;
 }
Exemplo n.º 18
0
 public virtual void Add(Box box)
 {
     this.children.Add(box);
 }