MTextSurrogate for DXF R12¶
- class ezdxf.addons.MTextSurrogate(text: str, insert: UVec, line_spacing: float = 1.5, align=MTextEntityAlignment.TOP_LEFT, char_height: float = 1.0, style='STANDARD', oblique: float = 0.0, rotation: float = 0.0, width_factor: float = 1.0, mirror=Mirror.NONE, layer='0', color: int = const.BYLAYER)¶
MTEXT surrogate for DXF R12 build up by TEXT Entities. This add-on was added to simplify the transition from
dxfwrite
toezdxf
.The rich-text formatting capabilities for the regular MTEXT entity are not supported, if these features are required use the regular MTEXT entity and the
MTextExplode
add-on to explode the MTEXT entity into DXF primitives.Important
The align-point is always the insert-point, there is no need for a second align-point because the horizontal alignments FIT, ALIGN, BASELINE_MIDDLE are not supported.
- Parameters:
text – content as string
insert – insert location in drawing units
line_spacing – line spacing in percent of height, 1.5 = 150% = 1+1/2 lines
align – text alignment as
MTextEntityAlignment
enumchar_height – text height in drawing units
style –
Textstyle
name as stringoblique – oblique angle in degrees, where 0 is vertical
rotation – text rotation angle in degrees
width_factor – text width factor as float
mirror –
MTextSurrogate.MIRROR_X
to mirror the text horizontal orMTextSurrogate.MIRROR_Y
to mirror the text verticallayer – layer name as string
color – AutoCAD Color Index (ACI)
- render(layout: GenericLayoutType) None ¶
Render the multi-line content as separated TEXT entities into the given layout instance.