Documentation ¶
Overview ¶
Package inline produces line boxes from khipus.
_________________________________________________________________________
BSD 3-Clause License ¶
Copyright (c) 2020–21, Norbert Pillmayer ¶
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
- Constants
- func BreakParagraph(para *Paragraph, box *frame.Box) ([]frame.Container, error)
- func Layout(c frame.Container)
- func OutlineParshape(box *frame.Box, leftAlign, rightAlign []*frame.Box) linebreak.ParShape
- func T() tracing.Trace
- func XFindParaWidthAndText(pbox *ParagraphBox, rootctx frame.Context) ([]frame.Container, frame.Context, error)
- type LineBox
- func (lbox *LineBox) AppendToPrincipalBox(pbox *boxtree.PrincipalBox)
- func (lbox *LineBox) CSSBox() *frame.Box
- func (lbox *LineBox) Context() frame.Context
- func (lbox *LineBox) DOMNode() *dom.W3CNode
- func (lbox *LineBox) PresetContained() bool
- func (lbox *LineBox) SetContext(ctx frame.Context)
- func (lbox *LineBox) TreeNode() *tree.Node
- func (pbox *LineBox) Type() frame.ContainerType
- type Paragraph
- type ParagraphBox
- func (pbox *ParagraphBox) CSSBox() *frame.Box
- func (pbox *ParagraphBox) ChildIndices() (uint32, uint32)
- func (pbox *ParagraphBox) Context() frame.Context
- func (pbox *ParagraphBox) DOMNode() *dom.W3CNode
- func (pbox *ParagraphBox) PresetContained() bool
- func (pbox *ParagraphBox) SetContext(ctx frame.Context)
- func (pbox *ParagraphBox) TreeNode() *tree.Node
- func (pbox *ParagraphBox) Type() frame.ContainerType
Constants ¶
const ( TypeLine frame.ContainerType = 200 TypeParagraph frame.ContainerType = 201 )
TypeLine and TypeParagraph are additional container types defined in this package.
Variables ¶
This section is empty.
Functions ¶
func BreakParagraph ¶
BreakParagraph breaks a khipu (of a paragraph) into lines, given the outline of the frame where the text has to fit into. It returns the same pbox, but now including anonymous line boxes for the text, and the height value of the principal box will be set.
If an error occurs during line-breaking, a pbox of nil is returned, together with the error value.
func OutlineParshape ¶
func XFindParaWidthAndText ¶
Types ¶
type LineBox ¶
type LineBox struct { frame.ContainerBase //tree.Node Box *frame.Box // contains filtered or unexported fields }
LineBox is a type for CSS inline text boxes.
func (*LineBox) AppendToPrincipalBox ¶
func (lbox *LineBox) AppendToPrincipalBox(pbox *boxtree.PrincipalBox)
func (*LineBox) DOMNode ¶
DOMNode returns the underlying DOM node for a render tree element. For line boxes, it returns the DOM node corresponding to the parent container, which should be of type PrincipalBox.
func (*LineBox) PresetContained ¶
func (*LineBox) SetContext ¶
type Paragraph ¶
type Paragraph struct { *styled.Paragraph // a Paragraph is a styled text Khipu *khipu.Khipu // knot-encoding of the paragraph's text Regs *parameters.TypesettingRegisters // contains filtered or unexported fields }
Paragraph represents a styled paragraph of text, from a W3C DOM.
type ParagraphBox ¶
type ParagraphBox struct { frame.ContainerBase Box *frame.StyledBox // styled box for a DOM node // contains filtered or unexported fields }
func (*ParagraphBox) CSSBox ¶
func (pbox *ParagraphBox) CSSBox() *frame.Box
CSSBox returns the underlying box of a render tree element.
func (*ParagraphBox) ChildIndices ¶
func (pbox *ParagraphBox) ChildIndices() (uint32, uint32)
func (*ParagraphBox) Context ¶
func (pbox *ParagraphBox) Context() frame.Context
func (*ParagraphBox) DOMNode ¶
func (pbox *ParagraphBox) DOMNode() *dom.W3CNode
DOMNode returns the underlying DOM node for a render tree element.
func (*ParagraphBox) PresetContained ¶
func (pbox *ParagraphBox) PresetContained() bool
func (*ParagraphBox) SetContext ¶
func (pbox *ParagraphBox) SetContext(ctx frame.Context)
func (*ParagraphBox) TreeNode ¶
func (pbox *ParagraphBox) TreeNode() *tree.Node
TreeNode returns the underlying tree node for a box.
func (*ParagraphBox) Type ¶
func (pbox *ParagraphBox) Type() frame.ContainerType
Type returns TypeParagraph