Пример #1
0
        public LineBreaking.IUnjustifiedLine<Printing.IPrintableLine> CreateLine(LineBreaking.ILineConstraint constraint, InlineStyle style, LineBreaking.IBreakPoint from, LineBreaking.IBreakPoint to, out InlineStyle newStyle)
        {
            IInterletter fromAsJapaneseInterletterspace;
            IInterletter toAsJapaneseInterletterspace;
            StartOfParagraph fromAsStart;
            EndOfParagraph toAsEnd;

            fromAsJapaneseInterletterspace = from as IInterletter;
            toAsJapaneseInterletterspace = to as IInterletter;
            if (fromAsJapaneseInterletterspace != null)
            {
                if (toAsJapaneseInterletterspace != null)
                {
                    return CreateLine(constraint, fromAsJapaneseInterletterspace, toAsJapaneseInterletterspace, style, out newStyle);
                }
                else
                {
                    toAsEnd = to as EndOfParagraph;
                    if (toAsEnd != null)
                    {
                        return CreateLine(constraint, fromAsJapaneseInterletterspace, toAsEnd, style, out newStyle);
                    }
                    else
                    {
                        throw new ArgumentException("type error", "to");
                    }
                }
            }
            else
            {
                fromAsStart = from as StartOfParagraph;
                if (fromAsStart != null)
                {

                    if (toAsJapaneseInterletterspace != null)
                    {
                        return CreateLine(constraint, fromAsStart, toAsJapaneseInterletterspace, style, out newStyle);
                    }
                    else
                    {
                        toAsEnd = to as EndOfParagraph;
                        if (toAsEnd != null)
                        {
                            return CreateLine(constraint, fromAsStart, toAsEnd, style, out newStyle);
                        }
                        else
                        {
                            throw new ArgumentException("type error", "to");
                        }
                    }
                }
                else
                {
                    throw new ArgumentException("type error", "start");
                }
            }
        }
Пример #2
0
        public FieldRule(
            int width = 10,
            LineBreaking lineBreaking = LineBreaking.Anywhere,
            Align align       = Align.Left,
            int paddingLeft   = 0,
            int paddingRight  = 0,
            int paddingTop    = 0,
            int paddingBottom = 0)
        {
            if (width <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(width));
            }

            if (paddingLeft < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(paddingLeft));
            }
            if (paddingRight < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(paddingRight));
            }
            if (paddingTop < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(paddingTop));
            }
            if (paddingBottom < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(paddingBottom));
            }

            this.Width        = width;
            this.Align        = align;
            this.LineBreaking = lineBreaking;

            this.PaddingLeft   = paddingLeft;
            this.PaddingRight  = paddingRight;
            this.PaddingTop    = paddingTop;
            this.PaddingBottom = paddingBottom;
        }
Пример #3
0
 private LineBreaking.IUnjustifiedLine<Printing.IPrintableLine> CreateLine(LineBreaking.ILineConstraint constraint, StartOfParagraph from, IInterletter to, InlineStyle style, out InlineStyle newStyle)
 {
     var toIndex = Array.IndexOf(_objectList, to);
     if (toIndex == -1) throw new ArgumentException("to");
     return InlineLayoutEngine.Solve(constraint, from.Glue, _objectList.Take(toIndex), to.GlueBeforeBreak, PenaltyValue(to), _heading, style, out newStyle);
 }
Пример #4
0
 private LineBreaking.IUnjustifiedLine<Printing.IPrintableLine> CreateLine(LineBreaking.ILineConstraint constraint, StartOfParagraph from, EndOfParagraph to, InlineStyle style, out InlineStyle newStyle)
 {
     return InlineLayoutEngine.Solve(constraint, from.Glue, _objectList, to.Glue, PenaltyValue(to), _heading, style, out newStyle);
 }
Пример #5
0
 private static int PenaltyValue(LineBreaking.IBreakPoint to)
 {
     return to.Penalty;
 }
Пример #6
0
 private LineBreaking.IUnjustifiedLine<Printing.IPrintableLine> CreateLine(LineBreaking.ILineConstraint constraint, IInterletter from, EndOfParagraph to, InlineStyle style, out InlineStyle newStyle)
 {
     var fromIndex = Array.IndexOf(_objectList, from);
     if (fromIndex == -1) throw new ArgumentException("from");
     return InlineLayoutEngine.Solve(
         constraint,
         new GlueProperty(from.IndentAfterBreak, 0, 0),
         _objectList.Skip(fromIndex + 1), to.Glue, PenaltyValue(to), _heading, style, out newStyle);
 }