|Draft → Shape from text ...|
|Introduced in version|
|Draft Text, Part Extrude|
The ShapeString tool inserts a compound shape that represents a text string. Text height, tracking and font can be specified. The resulting shape can be used with the Part Extrude tool to create 3D letters.
The Draft Text tool is a simpler alternative that does not produce a closed shape.
How to use
- Press the button, or press then keys.
- Click a point on the 3D view, or type a coordinate and press the button.
- Enter the desired text, and press .
- Enter the desired size, and press .
- Enter the desired tracking, and press .
- Press to accept the displayed font file, or press to select a font file.
The text, size, tracking, and font can be changed after creation, by modifying its properties.
- To enter coordinates manually, simply enter the numbers, then press between each X, Y and Z component.
- Press or the button to abort the current command.
- DataPosition: The base point of the compound shape
- DataString: The contents of the text string
- DataSize: The height of the letters in FC units
- DataTracking: The inter-character spacing in FC units
- DataFont File: The font definition file used to draw the string
The ShapeString tool can be used in macros and from the Python console by using the following function:
ShapeString = makeShapeString(String, FontFile, Size=100, Tracking=0)
- Creates a
ShapeStringcompound shape using the specified
FontFileis mandatory and must be the full path of a supported font file
Sizeis the height of the resulting text in millimeters
Trackingis the additional inter-character spacing in millimeters
import FreeCAD, Draft Draft.makeShapeString("This is a sample text", "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", 200.0, 10)
Selecting A Font
ShapeString uses the internal geometry of a font to make FreeCAD shapes. To do this it must read the actual font file (*.tff, etc). If the Font Selection box is empty, you must type the full path to the font file or useto select a font file.
- This tool is not available in FreeCAD versions anterior to 0.14
- TrueType(*.ttf), OpenType(*.otf) and Type1(*.pfb) font files are supported.
- Very small text heights may result in deformed character glyphs due to loss of detail in scaling.
- The current version is limited to left-to-right layouts on a horizontal baseline.
- For creating curved text you can use the macro Circular Text