public static void VerticalDraw(this List <BaseNode> list, Cairo.Context cr, double xPos, double yPos, PrintLayer layer) { // Draw all of the children vertically, but to keep the lines correctly, we will actually // render them in reverse from the bottom up. for (int i = list.Count - 1; i >= 0; i--) { BaseNode node = list[i]; TextExtents extents = node.GetExtents(cr); node.Draw(cr, xPos, yPos, layer); yPos -= extents.Height + extents.YAdvance; } }
public bool TryAddLine(Cairo.Context cr, BaseNode lineNode) { // If we have not yet determined the actual page height, calculate it now. if (_availablePageHeight == 0) { _availablePageHeight = _pageSettings.PageHeight; if (_header != null) { _availablePageHeight -= _header.GetExtents(cr).Height; } if (_footer != null) { _availablePageHeight -= _footer.GetExtents(cr).Height; } } // Now see if the text field will fit on our page. bool retval = false; TextExtents extents = lineNode.GetExtents(cr); if (_currentYPos + extents.Height < _availablePageHeight) { if (_currentRegion != null) { _currentRegion.AddNode(lineNode); } else { _children.Add(lineNode); } retval = true; _currentYPos += extents.Height + extents.YAdvance; } return(retval); }