richtext

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package richtext implements a PDF component for paragraphs with mixed inline styling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAutoRow

func NewAutoRow(runs []props.RichRun, ps ...props.RichText) core.Row

NewAutoRow wraps a RichText in an auto-height Row.

func NewCol

func NewCol(size int, runs []props.RichRun, ps ...props.RichText) core.Col

NewCol wraps a RichText in a Col of the given grid size.

func NewRow

func NewRow(height float64, runs []props.RichRun, ps ...props.RichText) core.Row

NewRow wraps a RichText in a fixed-height Row.

Types

type RichText

type RichText struct {
	// contains filtered or unexported fields
}

RichText is a paragraph component that renders inline runs with mixed styles. It implements core.Component and can be placed inside Col/Row like any other component.

func New

func New(runs []props.RichRun, ps ...props.RichText) *RichText

New creates a RichText component.

func (*RichText) GetHeight

func (r *RichText) GetHeight(provider core.Provider, cell *entity.Cell) float64

GetHeight returns the height the component will occupy in the cell. The result is memoised by cell width so Paper's two-call pattern (addRow + Render) doesn't drift even when SetConfig is called between invocations.

func (*RichText) GetStructure

func (r *RichText) GetStructure() *node.Node[core.Structure]

GetStructure returns the component tree node for debugging/snapshot tests.

func (*RichText) Render

func (r *RichText) Render(provider core.Provider, cell *entity.Cell)

Render draws the component. If the provider implements core.RichTextProvider, it delegates to AddRichText for accurate per-run styling. Otherwise it falls back to AddText with the first run's style.

func (*RichText) SetConfig

func (r *RichText) SetConfig(config *entity.Config)

SetConfig propagates Paper configuration to the component.

func (*RichText) WithAnchorRegistry

func (r *RichText) WithAnchorRegistry(reg anchorResolverIface) *RichText

WithAnchorRegistry attaches an anchor registry so that runs with LocalAnchor produce precise per-run PDF link rectangles at render time.

Jump to

Keyboard shortcuts

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