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
- words(container)¶
The words making up this paragraph’s text
- Returns:¶
(list, list) – the words, and for each word (plus one for the end of the paragraph), the styled text items to register with the container (style log,
before_placing()) when consuming it
The words are cached, so that they are not recreated each time the paragraph is rendered (e.g. to measure it). The cache is valid for the current document part rendering pass, or for the current page only when the text contains page-dependent fields (e.g. the page number). Inline flowables are flowed into a virtual container that is placed later, so these need to be created for each rendering.
- content_width(width, container)¶
Return the width of this flowable’s content, as returned by
render(), when rendered into a container of widthReturns None if this can only be determined by rendering. container is only used for looking up styles and the like.
-
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.
-
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, index=
0, first_word=None, _initial=True)¶ The position of the next word to typeset in a paragraph’s words
Styled Text (rinoh.text)¶
-
class rinoh.text.StyledText(id=
None, style=None, parent=None, source=None)¶ Base class for text that has a
TextStyleassociated with it.- to_string(flowable_target)¶
Return the text content of this styled text.
- property items¶
The list of items in this StyledText.
-
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:¶
- prepare(flowable_target)¶
Determine number labels and register references with the document
- append(item)¶
Append item (
StyledTextorstr) 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.
- 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:¶
- 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
Noneif 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:¶
- 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:¶
- 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¶
Miscellaneous Internals¶
- class rinoh.paragraph.HyphenatorStore¶