layout

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLine

func IsLine(box Box) bool

IsLine returns wheter `box` is either an instance of LineBox or InlineBox.

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) IsClassicalBox

func (AbsolutePlaceholder) IsClassicalBox() bool

func (AbsolutePlaceholder) String

func (abs AbsolutePlaceholder) String() string

func (*AbsolutePlaceholder) Translate

func (abs *AbsolutePlaceholder) Translate(box Box, dx, dy pr.Float, ignoreFloats bool)

type AliasBox

type AliasBox = bo.Box

type Box

type Box = bo.Box

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL