- class neoscore.core.rich_text.RichText
A graphical rich text object.
Unlike its simpler counterpart in
Text, this supports rich formatting with HTML input. As neoscore is currently backed by Qt, this input supports Qt’s HTML subset documented at https://doc.qt.io/qt-5/richtext-html-subset.html
- __init__(pos: PointDef, parent: Optional[PositionedObject], html_text: str, width: Optional[Unit] = None, font: Optional[Font] = None, scale: float = 1, rotation: float = 0, z_index: int = 0)
pos – Position relative to the parent
parent – The parent (core-level) object or None
html_text – The text to be displayed, written in HTML.
width – The maximum width for the displayed text. If omitted, lines will only break when explicitly called for by the HTML.
font – The default font to display the text in.
scale – A scaling factor relative to the font size.
rotation – Rotation angle in degrees.
z_index – Controls draw order with lower values drawn first.
- property breakable_length: Unit
The breakable length of the object.
This is always 0, meaning RichText objects cannot be broken across Flowable lines.
- property html_text: str
The text to be displayed, written in HTML.
- property width: Optional[Unit]
The maximum width for the displayed text.
If omitted, lines will only break when explicitly called for by the HTML.
- property font: Font
The default font used to display the text.
HTML markup can override this to different styles and famililes.
- property scale: float
A scale factor to be applied to the rendered text
- property rotation: float
An angle in degrees to rotate about the text origin
- property z_index: int
Value controlling draw order with lower values being drawn first
- render_complete(pos: Point, flowable_line: Optional[NewLine] = None, flowable_x: Optional[Unit] = None)
Render the entire object.
This is used to render all objects outside flowables, as well as those inside flowables when they fit completely in one line of the flowable.
By default, this is a no-op. Subclasses with rendered appearances should override this.
This and other render methods should generally not be called directly.
pos – The rendering position in document space for drawing.
flowable_line – If in a
Flowable, the line in which this object appears
flowable_x – If in a
Flowable, the flowable x position of this render