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 to ezdxf.

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.


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.

  • 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 enum

  • char_height – text height in drawing units

  • styleTextstyle name as string

  • oblique – oblique angle in degrees, where 0 is vertical

  • rotation – text rotation angle in degrees

  • width_factor – text width factor as float

  • mirrorMTextSurrogate.MIRROR_X to mirror the text horizontal or MTextSurrogate.MIRROR_Y to mirror the text vertical

  • layer – layer name as string

  • colorAutoCAD Color Index (ACI)

render(layout: GenericLayoutType) None

Render the multi-line content as separated TEXT entities into the given layout instance.