Fonts & Font Styles

Fonts

Build123D Mode currently has access to the following fonts:

  • DejaVu Serif
  • DejaVu Sans Mono
  • FreeSans
  • DejaVu Sans
  • FreeSerif
  • FreeMono
  • FreeSans Bold
  • FreeSerif Bold Italic
  • FreeMono Bold Oblique
  • DejaVu Sans-Bold
  • DejaVu SansMono-Bold
  • FreeSans Bold Oblique
  • FreeSerifBold
  • FreeSerifItalic
  • FreeMonoBold

Font Styles:

Build123D Mode currently has the following font_styles:

FontStyle.REGULAR
FontStyle.ITALIC
FontStyle.BOLD

example code:

# Define the text to be used
text = "hello"

# Set the dimensions and font size
length, width, thickness, fontsize, fontht = 80.0, 60.0, 10.0, 25.0, 4.0

# Define the plane for the text
plane = Plane.XY

# Create the 2D text "hello" on the defined plane
regular = plane * Text(text, font="DejaVu Sans", font_style=FontStyle.REGULAR, font_size=fontsize, align=(Align.CENTER, Align.MIN))
italic = plane * Text(text, font="DejaVu Sans", font_style=FontStyle.ITALIC, font_size=fontsize, align=(Align.CENTER, Align.MIN))
bold = plane * Text(text, font="DejaVu Sans", font_style=FontStyle.BOLD, font_size=fontsize, align=(Align.CENTER, Align.MIN))

#combine 
combo = regular + italic.translate((0,-20,0)) + bold.translate((0,-40,0))

# Extrude the 2D text to create 3D text
text_3d = extrude(combo, amount=fontht)

# Save the 3D text object
save = text_3d

Curved Font Example

(via Text on top of cylinder · gumyr/build123d · Discussion #551 · GitHub)


r2 = 100
r1 = 80
fs = 33

base_cylinder = Cylinder(r2, 300)
top = base_cylinder.faces().sort_by(Axis.Z)[-1]
text_path = (top - offset(top, r1 - r2)).face().inner_wires()[0]

text = Text(
    "around the world around the world", font_size=fs, path=text_path, position_on_path=0.45
)
embossed_text = extrude(text, 5)

save = embossed_text