partforge 0.73.1 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,15 @@ export default {
23
23
  description: "Grow (>0, bolder) or shrink (<0, thinner) the letters with a **Shape2D offset** — the same operation used for print clearance. Large negative values collapse thin strokes, so the letters hold at their thinnest valid size rather than breaking." },
24
24
  ],
25
25
  },
26
+ {
27
+ id: "typeface",
28
+ title: "Typeface",
29
+ description: "The face the lettering is cut in. Falls back to the bundled Roboto when left as the default.",
30
+ controls: [
31
+ { key: "face", type: "font", label: "Typeface",
32
+ description: "Any face the host's font catalog offers. Without a catalog this is a URL field — a direct link to a `.ttf` or `.otf` that allows cross-origin requests." },
33
+ ],
34
+ },
26
35
  {
27
36
  id: "plate",
28
37
  title: "Plate",
@@ -45,14 +54,19 @@ export default {
45
54
  ],
46
55
  },
47
56
  ],
48
- defaults: { label: "PARTFORGE\nv0.20", size: 8, depth: 1.2, stroke: 0, margin: 4, corner: 3, thickness: 3, engrave: 0 },
57
+ defaults: { label: "PARTFORGE\nv0.20", size: 8, depth: 1.2, stroke: 0, margin: 4, corner: 3, thickness: 3, engrave: 0, face: "" },
58
+ // A function of params, not a static map — that is what makes `face` a
59
+ // parameter rather than a constant. An empty value declares nothing, and
60
+ // text2d falls back to the bundled Roboto.
61
+ fonts: (p) => (p.face ? { face: p.face } : {}),
49
62
  parts: {
50
63
  plate: {
51
64
  label: "Nameplate",
52
65
  views: ["plate"],
53
66
  export: { name: "nameplate" },
54
67
  build: (k, p) => {
55
- let text = k.text2d(p.label, { size: p.size, align: "center", valign: "middle", lineHeight: p.size * 1.7 });
68
+ let text = k.text2d(p.label, { size: p.size, align: "center", valign: "middle",
69
+ lineHeight: p.size * 1.7, ...(p.face ? { font: "face" } : {}) });
56
70
  // Shape2D offset on the lettering: grow (>0, bolder) or shrink (<0, thinner). Guard
57
71
  // against a shrink that collapses thin strokes — keep the un-offset letters if so.
58
72
  if (p.stroke !== 0) {