Documentation
¶
Overview ¶
Transform a "before layout" box tree into an "after layout" tree, by breaking boxes across lines and pages; and determining the position and dimension of each box fragment.
Boxes in the new tree have `used values` in their PositionX, PositionY, Width and Height attributes, amongst others. (see https://www.w3.org/TR/CSS21/cascade.html#used-value)
The laid out pages are ready to be printed or display on screen, which is done by the higher level `document` package.
Index ¶
- func DefaultImageSizing(...) (concreteWidth, concreteHeight pr.Float)
- func IsLine(box Box) bool
- func Layout(html *tree.HTML, stylesheets []tree.CSS, presentationalHints bool, ...) []*bo.PageBox
- func LayoutReplacedBox(box_ bo.ReplacedBoxITF) (drawWidth, drawHeight, positionX, positionY pr.Float)
- type AbsolutePlaceholder
- type AliasBox
- type Box
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultImageSizing ¶ added in v0.0.10
func DefaultImageSizing(intrinsicWidth, intrinsicHeight, intrinsicRatio, specifiedWidth, specifiedHeight pr.MaybeFloat, defaultWidth, defaultHeight pr.Float, ) (concreteWidth, concreteHeight pr.Float)
Default sizing algorithm for the concrete object size. https://drafts.csswg.org/csswg/css-images-3/#default-sizing
func Layout ¶
func Layout(html *tree.HTML, stylesheets []tree.CSS, presentationalHints bool, fontConfig text.FontConfiguration) []*bo.PageBox
Layout lay out the whole document, returning one box per pages.
This includes line breaks, page breaks, absolute size and position for all boxes.
func LayoutReplacedBox ¶
func LayoutReplacedBox(box_ bo.ReplacedBoxITF) (drawWidth, drawHeight, positionX, positionY pr.Float)
LayoutReplacedBox computes the dimension of the content of a replaced box.
Types ¶
type AbsolutePlaceholder ¶
type AbsolutePlaceholder struct { AliasBox // contains filtered or unexported fields }
AbsolutePlaceholder is left where an absolutely-positioned box was taken out of the flow.
func NewAbsolutePlaceholder ¶
func NewAbsolutePlaceholder(box Box) *AbsolutePlaceholder
func (AbsolutePlaceholder) Copy ¶
func (abs AbsolutePlaceholder) Copy() Box
func (AbsolutePlaceholder) String ¶
func (abs AbsolutePlaceholder) String() string
func (*AbsolutePlaceholder) Translate ¶
func (abs *AbsolutePlaceholder) Translate(box Box, dx, dy pr.Float, ignoreFloats bool)
func (AbsolutePlaceholder) Type ¶ added in v0.0.10
func (AbsolutePlaceholder) Type() bo.BoxType