Paragraph (rinoh.paragraph)

class rinoh.paragraph.ParagraphBase(custom_label=None, align=None, width=None, id=None, style=None, parent=None, source=None)

Base class for paragraphs

A paragraph holds styled text and other line elements to be flowed into a container.

style_class

alias of ParagraphStyle

prepare(flowable_target)

Determine number labels and register references with the document

render(container, descender, state, space_below=0, first_line_only=False)

Typeset the paragraph

The paragraph is typeset in the given container starting below the current cursor position of the container. When the end of the container is reached, the rendering state is preserved to continue setting the rest of the paragraph when this method is called with a new container.

Parameters:
container : Container

the container to render to

descender : float or None

descender height of the preceding line

state : ParagraphState

the state where rendering will continue

first_line_only : bool

typeset only the first line

class rinoh.paragraph.Paragraph(content, custom_label=None, align=None, width=None, id=None, style=None, parent=None, source=None)
class rinoh.paragraph.ParagraphState(paragraph, language, span_index=0, group_index=0, nested_flowable_state=None, _first_word=None, _initial=True)

Styled Text (rinoh.text)

class rinoh.text.StyledText(id=None, style=None, parent=None, source=None)

Base class for text that has a TextStyle associated with it.

to_string(flowable_target)

Return the text content of this styled text.

is_script(container)

Returns True if this styled text is super/subscript.

script_level(container)

Nesting level of super/subscript.

height(container)

Font size after super/subscript size adjustment.

y_offset(container)

Vertical baseline offset (up is positive).

property items

The list of items in this StyledText.

style_class

alias of TextStyle

class rinoh.text.SingleStyledText(text, style=None, parent=None, source=None)

Text with a single style applied

class rinoh.text.MixedStyledText(text_or_items, id=None, style=None, parent=None, source=None)

Concatenation of styled text

Parameters:
text_or_items : str, StyledText or iterable of these

mixed styled text

style=None

see Styled

parent=None

see DocumentElement

prepare(flowable_target)

Determine number labels and register references with the document

append(item)

Append item (StyledText or str) to the end of this mixed-styled text.

The parent of item is set to this mixed-styled text.

property items

The list of items in this StyledText.

copy(parent=None)

Return a shallow copy of the list.

class rinoh.text.Locale

Selects a language

class rinoh.text.NoBreakAfter(iterable=(), /)

List of words after which no line break will be allowed

Inline Elements (rinoh.inline)

class rinoh.inline.InlineFlowable(baseline=None, id=None, style=None, parent=None, source=None)
style_class

alias of InlineFlowableStyle

Styling Properties

class rinoh.paragraph.TextAlign

Text justification

Accepts: left, right, center, justify

Line Spacing

class rinoh.paragraph.LineSpacing

Base class for line spacing types

Line spacing is defined as the distance between the baselines of two consecutive lines of text in a paragraph.

advance(line, last_descender, container)

Return the distance between the descender of the previous line and the baseline of the current line.

class rinoh.paragraph.DefaultSpacing

The default line spacing as specified by the font.

advance(line, last_descender, container)

Return the distance between the descender of the previous line and the baseline of the current line.

class rinoh.paragraph.ProportionalSpacing(factor)

Line spacing proportional to the line height

Parameters:
factor : float

amount by which the line height is multiplied to obtain the line spacing

advance(line, last_descender, container)

Return the distance between the descender of the previous line and the baseline of the current line.

class rinoh.paragraph.FixedSpacing(pitch, minimum=ProportionalSpacing(1.0))

Fixed line spacing, with optional minimum spacing

Parameters:
pitch : Dimension

the distance between the baseline of two consecutive lines of text

minimum : LineSpacing

the minimum line spacing to prevents lines with large fonts (or inline elements) from overlapping; set to None if no minimum is required, set to None

advance(line, last_descender, container)

Return the distance between the descender of the previous line and the baseline of the current line.

class rinoh.paragraph.Leading(leading)

Line spacing determined by the space in between two lines

Parameters:
leading : Dimension

the space between the bottom of a line and the top of the next line of text

advance(line, last_descender, container)

Return the distance between the descender of the previous line and the baseline of the current line.

The following standard line spacings have been predefined:

rinoh.paragraph.DEFAULT = DefaultSpacing()

The default line spacing as specified by the font.

rinoh.paragraph.STANDARD = ProportionalSpacing(1.2)

Line spacing of 1.2 times the line height.

rinoh.paragraph.SINGLE = ProportionalSpacing(1.0)

Line spacing equal to the line height (no leading).

rinoh.paragraph.DOUBLE = ProportionalSpacing(2.0)

Line spacing of double the line height.

Tabulation

class rinoh.paragraph.TabAlign

Alignment of text with respect to a tab stop

Accepts: left, right, center

class rinoh.paragraph.TabStop(position, align='left', fill=None)

Horizontal position for aligning text of successive lines

Parameters:
position

tab stop position

align : TabAlign

the alignment of text with respect to the tab stop position

fill : str

string pattern to fill the empty tab space with

get_position(line_width)

Return the absolute position of this tab stop.

class rinoh.paragraph.TabStopList(iterable=(), /)

List of tab stop positions (with alignment and fill string)

Rendering Internals

class rinoh.paragraph.Glyph(metrics, width, char)
class rinoh.paragraph.GlyphsSpan(span, chars_to_glyphs, glyphs=[])

Miscellaneous Internals

class rinoh.paragraph.HyphenatorStore