• Models
  • Contests
  • Slicer
  • Login
  • Start Here
    thingiverse-iconprintables-iconcults3d-iconmakerworld-iconmyminifactory-icon

    3D GO

    3D ModelsContestsCollectionsSaved ModelsOn a mobile device?

3D GO

Privacy Policy
Hershey fonts for OpenSCAD 3D Printer File Image 1
Hershey fonts for OpenSCAD 3D Printer File Image 2
Hershey fonts for OpenSCAD 3D Printer File Thumbnail 1
Hershey fonts for OpenSCAD 3D Printer File Thumbnail 2

Hershey fonts for OpenSCAD

arpruss avatararpruss

March 27, 2021

cults3d-icon
DescriptionCommentsTags

Description

The standard OpenSCAD fonts work well for a simple extrusion 3D profile. But what if you want a different 3D profile, e.g., you want text that looks like it's been machined with a V-shaped bit, or text that is rounded in 3D?

This library includes the ASCII portions of the Hershey vector fonts, and draws text using whatever convex shape you specify. For instance, you can do rounded text via:

use <hershey.scad>;
drawHersheyFont("Hello, OpenSCAD!", font="Script") sphere(r=2,$fn=16);

A call to drawHersheyFont() requires a child object that specifies what the drawing is done with. The drawing is done by putting the child object at the two endpoint of a lines and doing a hull() operation.

The following optional arguments are available:

halign="left"|"right"|"center": horizontal alignment
valign="top"|"baseline"|"center"|"bottom": vertical alignment
size=x: specify height of capital T
extraSpacing=x: add this extra spacing between letters (can be negative)
forceMinimumDistance=d: make sure that the distance (not necessarily horizontal) between successive glyphs is as close to d as reasonably possible; use this if you want to draw fat letters that overlap by the same amount, like here
minimumDistancePrecision=p: set the precision for the forceMinimumDistance option

There is also a function to measure text width: widthHersheyText(text, font=name), with optional size=x and extraSpacing=x parameters.

Unfortunately CGAL rendering is going to be very slow. The "Hello, OpenSCAD!" CGAL render took about three minutes.

Note the licensing on the Hershey library in the source code, which isn't fully compatible with Creative Commons -- but the restrictions are very, very slight.

Updates:

  • August 16, 2019: Optimize file size of hershey.scad for faster loading.

  • August 10, 2019: Added Latin1 accented characters. Fixed baseline alignment. Renamed fonts to be more intuitive (old names are still supported). Removed duplicate fonts.

License:

CC BY - Attribution

Related Models

V29 preview image

V29

jzisa profile image

jzisa

81,239

Spiral Vase Rose preview image

Spiral Vase Rose

lytta profile image

lytta

15,741

The Ultimate 3D Name Sign Generator preview image

The Ultimate 3D Name Sign Generator

Linova3D profile image

Linova3D

1,754

Cute Mini Octopus preview image

Cute Mini Octopus

McGybeer profile image

McGybeer

75,631

Moon City 2.0 preview image

Moon City 2.0

Kijai profile image

Kijai

15,064

Rose  preview image

Rose

3D Drucker profile image

3D Drucker

1,489

Modular Mounting System preview image

Modular Mounting System

HeyVye profile image

HeyVye

69,055

Low Poly Howling Wolf 2.0 (Decoration)(No Supports!) FIXED preview image

Low Poly Howling Wolf 2.0 (Decoration)(No Supports!) FIXED

BP3D profile image

BP3D

11,560