示例#1
0
        public static void CreateLineBoxes(Graphics g, CssBox blockBox)
        {
            blockBox.LineBoxes.Clear();
            float      actualRight      = blockBox.ActualRight - blockBox.ActualPaddingRight - blockBox.ActualBorderRightWidth;
            PointF     location         = blockBox.Location;
            float      x                = location.X + blockBox.ActualPaddingLeft - 0f + blockBox.ActualBorderLeftWidth;
            PointF     pointF           = blockBox.Location;
            float      y                = pointF.Y + blockBox.ActualPaddingTop - 0f + blockBox.ActualBorderTopWidth;
            float      actualTextIndent = x + blockBox.ActualTextIndent;
            float      single           = y;
            float      single1          = y;
            float      single2          = 0f;
            CssLineBox cssLineBox       = new CssLineBox(blockBox);

            CssLayoutEngine.FlowBox(g, blockBox, blockBox, actualRight, single2, x, ref cssLineBox, ref actualTextIndent, ref single, ref single1);
            foreach (CssLineBox lineBox in blockBox.LineBoxes)
            {
                CssLayoutEngine.BubbleRectangles(blockBox, lineBox);
                lineBox.AssignRectanglesToBoxes();
                CssLayoutEngine.ApplyAlignment(g, lineBox);
                if (blockBox.Direction != "rtl")
                {
                    continue;
                }
                CssLayoutEngine.ApplyRightToLeft(lineBox);
            }
            blockBox.ActualBottom = single1 + blockBox.ActualPaddingBottom + blockBox.ActualBorderBottomWidth;
        }
示例#2
0
 private static void BubbleRectangles(CssBox box, CssLineBox line)
 {
     if (box.Words.Count <= 0)
     {
         foreach (CssBox cssBox in box.Boxes)
         {
             CssLayoutEngine.BubbleRectangles(cssBox, line);
         }
     }
     else
     {
         float             single      = float.MaxValue;
         float             single1     = float.MaxValue;
         float             single2     = float.MinValue;
         float             single3     = float.MinValue;
         List <CssBoxWord> cssBoxWords = line.WordsOf(box);
         if (cssBoxWords.Count > 0)
         {
             foreach (CssBoxWord cssBoxWord in cssBoxWords)
             {
                 single  = Math.Min(single, cssBoxWord.Left);
                 single2 = Math.Max(single2, cssBoxWord.Right);
                 single1 = Math.Min(single1, cssBoxWord.Top);
                 single3 = Math.Max(single3, cssBoxWord.Bottom);
             }
             line.UpdateRectangle(box, single, single1, single2, single3);
             return;
         }
     }
 }