When a CNC plasma torch or CO2 laser cuts a standard TrueType font into 14ga steel or 3mm birch, every glyph with an enclosed counter — A, B, D, O, P, Q, R, 0, 4, 6, 8, 9, & — drops its interior center straight through the slat bed. In CAD terms, a TrueType glyph represents a counter as a nested clockwise hole inside a counter-clockwise outer contour. Once the outer loop completes, the interior metal has zero physical attachment to the surrounding plate.

Solving this cleanly in a browser-native CAD generator without heavyweight Boolean polygon libraries or fragile font-to-path hacks requires rethinking glyph representation from first principles. Here is how we compute guaranteed-simple, zero-dropped-island stencil polygons and single-stroke ISO engraving paths in pure TypeScript, verify every loop geometrically, and serialize directly to AutoCAD R12 (AC1009) DXF.

1. Disjoint Stencil Sub-Polygons with Parametric Bridge Width

Instead of slicing TrueType outlines with arbitrary rectangles (which routinely creates zero-area slivers, self-intersecting vertices, or sub-millimeter webs that melt under a 1.4 mm plasma kerf), each stencil glyph is defined parametrically in normalized unit space [0, advance] × [0, 1] as a set of disjoint simple closed polygons separated by a physical bridge gap bridgeWidthMm.

For example, the letter O is split into two C-shaped half-shells (left and right) separated vertically at x = advance / 2 ± gap / 2, where gap = bridgeWidthMm / capHeightMm. The letter A splits its crossbar and apex so the triangular counter stays permanently tethered to the surrounding plate. Because every sub-polygon is authored directly as a simple closed ring, there are no nested holes at all — every contour is an independent CUT cutout inside the solid sign plate.

To guarantee consistent winding for CAM lead-ins and kerf offset direction, every generated ring passes through a signed-area check enforcing counter-clockwise (CCW) orientation:

export interface Point2D { x: number; y: number; } export function signedArea(ring: readonly Point2D[]): number { let sum = 0; for (let i = 0; i < ring.length; i++) { const a = ring[i]; const b = ring[(i + 1) % ring.length]; sum += a.x * b.y - b.x * a.y; } return 0.5 * sum; } export function ensureCCW(ring: Point2D[]): Point2D[] { return signedArea(ring) < 0 ? [...ring].reverse() : ring; } 

2. Segment-Intersection & Minimum Bridge Clearance Verification

Parametric scaling can still break if a user enters a very small cap height (e.g., 18 mm text) combined with a wide plasma bridge (5.0 mm). Before any geometry reaches the preview or DXF exporter, we run two deterministic geometric assertions across every glyph's sub-polygons:

  1. Zero self-intersections: Every non-adjacent edge pair (e_i, e_j) within each ring must fail a strict proper-intersection test.
  2. Minimum pairwise bridge clearance: Every pair of distinct sub-polygons (P_a, P_b) belonging to the same glyph must maintain a minimum segment-to-segment Euclidean distance d_min >= bridgeWidthMm * 0.95.
function pointToSegmentDist(p: Point2D, a: Point2D, b: Point2D): number { const dx = b.x - a.x; const dy = b.y - a.y; const lenSq = dx * dx + dy * dy; if (lenSq < 1e-12) return Math.hypot(p.x - a.x, p.y - a.y); const t = Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq)); return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy)); } export function minPolygonClearance(polyA: Point2D[], polyB: Point2D[]): number { let minD = Infinity; for (let i = 0; i < polyA.length; i++) { const a1 = polyA[i]; const a2 = polyA[(i + 1) % polyA.length]; for (let j = 0; j < polyB.length; j++) { const b1 = polyB[j]; const b2 = polyB[(j + 1) % polyB.length]; minD = Math.min( minD, pointToSegmentDist(a1, b1, b2), pointToSegmentDist(a2, b1, b2), pointToSegmentDist(b1, a1, a2), pointToSegmentDist(b2, a1, a2) ); } } return minD; } 

If a bridge collapses below threshold for a given font size and kerf, we clamp the effective bridge ratio or surface a shop-floor warning immediately rather than exporting a broken DXF.

3. Exact Solid-Plate Preview via SVG fill-rule="evenodd"

Fabricators need to see the actual metal that remains, not just raw wireframe strokes. Because the sign border is a single outer closed loop (rectangle, rounded plate, or arched ranch gate silhouette) and every stencil sub-polygon and mounting hole is a disjoint interior loop, we can render the exact physical cutout in one SVG <path> element using fill-rule="evenodd":

const pathData = [ ringToSvgPath(outerPlateRing), ...mountingHoleRings.map(ringToSvgPath), ...stencilSubPolygons.map(ringToSvgPath), ].join(" "); // <path d={pathData} fill="#2a2f36" fillRule="evenodd" /> 

Because evenodd toggles inside/outside parity on every boundary crossing, the outer plate renders as solid steel while every bridged stencil cutout and bolt hole punches cleanly through to the background — giving an instant visual sanity check that zero islands are floating.

4. Dual-Layer AutoCAD R12 (AC1009) DXF: Closed CUT + Single-Stroke ENGRAVE

For aluminum equipment serial tags and industrial control panels, cutting text through the plate is rarely what you want — you want fast single-stroke laser marking or CNC drag-engraving. Standard outline fonts force the laser or spindle to trace both sides of every letter stroke, multiplying cycle time by 3×–6× and leaving doubled blobs at small sizes.

To support both workflows in a single universal CAD format that opens cleanly in SheetCam, LightBurn, VCarve, Fusion 360, and Mach3, we serialize to AutoCAD R12 (AC1009) using explicit layers:

  • CUT layer (ACI color 1 / Red): Closed POLYLINE entities (70 group flag = 1) for the outer plate and bridged stencil sub-polygons, plus exact native CIRCLE entities for mounting holes (never segmented polygons, so CAM hole-recognition rules work automatically).
  • ENGRAVE layer (ACI color 5 / Blue): Open single-stroke ISO vector POLYLINE entities (70 group flag = 0) with zero duplicate overlapping segments, ready for LightBurn Line mode or VCarve On-Vector engraving.
export function dxfPolyline(points: Point2D[], layer: "CUT" | "ENGRAVE", closed: boolean): string { const lines = [ "0", "POLYLINE", "8", layer, "66", "1", "70", closed ? "1" : "0", ]; for (const pt of points) { lines.push("0", "VERTEX", "8", layer, "10", pt.x.toFixed(4), "20", pt.y.toFixed(4)); } lines.push("0", "SEQEND"); return lines.join("\n"); } 

Try It Live in the Browser

You can test the parametric bridged stencil generator and single-line ISO engraving DXF exporter directly in your browser with zero installs or signups:

https://www.cutpathcad.com/stencil-text-dxf

For additional CNC plasma plate utilities and kerf-checked DXF tools:

https://www.cutpathcad.com/plasma-dxf

And when you are ready to pack multiple custom signs, brackets, and plates onto 4×8 or 5×10 steel sheets with kerf-aware guillotine nesting:

https://www.cutpathcad.com/sheet-nesting