inline

package
v0.1.0-experimental.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package inline produces line boxes from khipus.

_________________________________________________________________________

BSD 3-Clause License

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

View Source
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

func BreakParagraph(para *Paragraph, box *frame.Box) ([]frame.Container, error)

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 Layout

func Layout(c frame.Container)

func OutlineParshape

func OutlineParshape(box *frame.Box, leftAlign, rightAlign []*frame.Box) linebreak.ParShape

func T

func T() tracing.Trace

T traces to a global engine-tracer.

func XFindParaWidthAndText

func XFindParaWidthAndText(pbox *ParagraphBox, rootctx frame.Context) (
	[]frame.Container, frame.Context, error)

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 NewLineBox

func NewLineBox(k *khipu.Khipu, start, length int64, indent dimen.Dimen) *LineBox

func (*LineBox) AppendToPrincipalBox

func (lbox *LineBox) AppendToPrincipalBox(pbox *boxtree.PrincipalBox)

func (*LineBox) CSSBox

func (lbox *LineBox) CSSBox() *frame.Box

CSSBox returns the underlying box of a line.

func (*LineBox) Context

func (lbox *LineBox) Context() frame.Context

func (*LineBox) DOMNode

func (lbox *LineBox) DOMNode() *dom.W3CNode

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 (lbox *LineBox) PresetContained() bool

func (*LineBox) SetContext

func (lbox *LineBox) SetContext(ctx frame.Context)

func (*LineBox) TreeNode

func (lbox *LineBox) TreeNode() *tree.Node

TreeNode returns the underlying tree node for a line box.

func (*LineBox) Type

func (pbox *LineBox) Type() frame.ContainerType

Type returns TypeLine

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.

func TextOfParagraph

func TextOfParagraph(c frame.Container) (*Paragraph, []frame.Container, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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