예제 #1
0
        public override void RenderTo(IElementRenderer renderer, double x, double y)
        {
            renderer.RenderElement(this.BaseBox, x, y);

            if (this.Over)
            {
                // Draw delimeter and script boxes over base box.
                var centerY      = y - this.BaseBox.Height - this.DelimiterBox.Width;
                var translationX = x + this.DelimiterBox.Width / 2;
                var translationY = centerY + this.DelimiterBox.Width / 2;

                RenderDelimiter(translationX, translationY);

                // Draw script box as superscript.
                RenderScriptBox(centerY - this.Kern - this.ScriptBox !.Depth); // Nullable TODO: This probably needs null checking
            }
            else
            {
                // Draw delimeter and script boxes under base box.
                var centerY      = y + this.BaseBox.Depth + this.DelimiterBox.Width;
                var translationX = x + this.DelimiterBox.Width / 2;
                var translationY = centerY - this.DelimiterBox.Width / 2;

                RenderDelimiter(translationX, translationY);

                // Draw script box as subscript.
                RenderScriptBox(centerY + this.Kern + this.ScriptBox !.Height); // Nullable TODO: This probably needs null checking
            }

            void RenderDelimiter(double translationX, double translationY)
            {
                var transformations = new Transformation[]
                {
                    new Transformation.Translate(translationX, translationY),
                    new Transformation.Rotate(90)
                };

                renderer.RenderTransformed(
                    this.DelimiterBox,
                    transformations,
                    -this.DelimiterBox.Width / 2,
                    -this.DelimiterBox.Depth + this.DelimiterBox.Width / 2);
            }

            void RenderScriptBox(double yPosition)
            {
                if (this.ScriptBox != null)
                {
                    renderer.RenderElement(this.ScriptBox, x, yPosition);
                }
            }
        }
예제 #2
0
        public override void RenderTo(IElementRenderer renderer, double x, double y)
        {
            renderer.RenderElement(BaseBox, x, y);

            if (Over)
            {
                // Draw delimeter and script boxes over base box.
                var centerY      = y - BaseBox.Height - DelimeterBox.Width;
                var translationX = x + DelimeterBox.Width / 2;
                var translationY = centerY + DelimeterBox.Width / 2;

                RenderDelimiter(translationX, translationY);

                // Draw script box as superscript.
                RenderScriptBox(centerY - Kern - ScriptBox.Depth);
            }
            else
            {
                // Draw delimeter and script boxes under base box.
                var centerY      = y + BaseBox.Depth + DelimeterBox.Width;
                var translationX = x + DelimeterBox.Width / 2;
                var translationY = centerY - DelimeterBox.Width / 2;

                RenderDelimiter(translationX, translationY);

                // Draw script box as subscript.
                RenderScriptBox(centerY + Kern + ScriptBox.Height);
            }

            void RenderDelimiter(double translationX, double translationY)
            {
                var transformations = new Transformation[]
                {
                    new Transformation.Translate(translationX, translationY),
                    new Transformation.Rotate(90)
                };

                renderer.RenderTransformed(
                    DelimeterBox,
                    transformations,
                    -DelimeterBox.Width / 2,
                    -DelimeterBox.Depth + DelimeterBox.Width / 2);
            }

            void RenderScriptBox(double yPosition)
            {
                if (ScriptBox != null)
                {
                    renderer.RenderElement(ScriptBox, x, yPosition);
                }
            }
        }
예제 #3
0
        public override void RenderTo(IElementRenderer renderer, double x, double y)
        {
            var curX = x;

            foreach (var box in Children)
            {
                renderer.RenderElement(box, curX, y + box.Shift);
                curX += box.Width;
            }
        }
예제 #4
0
        public override void RenderTo(IElementRenderer renderer, double x, double y)
        {
            var curY = y - this.Height;

            foreach (var child in this.Children)
            {
                curY += child.Height;
                renderer.RenderElement(child, x + child.Shift - this.leftMostPos, curY);
                curY += child.Depth;
            }
        }
예제 #5
0
 public void RenderFormulaTo(IElementRenderer renderer, double x, double y)
 {
     renderer.RenderElement(Box, x / Scale, y / Scale + Box.Height);
     renderer.FinishRendering();
 }
예제 #6
0
 public void RenderFormulaTo(IElementRenderer renderer, double x, double y) =>
 renderer.RenderElement(Box, x / Scale, y / Scale + Box.Height);