circuit-to-canvas 0.0.9 → 0.0.10

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.
package/dist/index.js CHANGED
@@ -819,7 +819,6 @@ var GLYPH_WIDTH_RATIO = 0.62;
819
819
  var LETTER_SPACING_RATIO = 0.3;
820
820
  var SPACE_WIDTH_RATIO = 1;
821
821
  var STROKE_WIDTH_RATIO = 0.13;
822
- var CURVED_GLYPHS = /* @__PURE__ */ new Set(["O", "o", "0"]);
823
822
  function getAlphabetLayout(text, fontSize) {
824
823
  const glyphWidth = fontSize * GLYPH_WIDTH_RATIO;
825
824
  const letterSpacing = glyphWidth * LETTER_SPACING_RATIO;
@@ -873,23 +872,7 @@ function strokeAlphabetText(ctx, text, layout, startX, startY) {
873
872
  characters.forEach((char, index) => {
874
873
  const lines = getGlyphLines(char);
875
874
  const advance = char === " " ? spaceWidth : glyphWidth;
876
- if (CURVED_GLYPHS.has(char)) {
877
- const normalizedCenterY = 0.5;
878
- const centerY = topY + normalizedCenterY * height;
879
- const radiusX = Math.max(glyphWidth / 2 - strokeWidth / 2, strokeWidth);
880
- const radiusY = Math.max(height / 2 - strokeWidth / 2, strokeWidth);
881
- ctx.beginPath();
882
- ctx.ellipse(
883
- cursor + glyphWidth / 2,
884
- centerY,
885
- radiusX,
886
- radiusY,
887
- 0,
888
- 0,
889
- Math.PI * 2
890
- );
891
- ctx.stroke();
892
- } else if (lines?.length) {
875
+ if (lines?.length) {
893
876
  ctx.beginPath();
894
877
  for (const line of lines) {
895
878
  const x1 = cursor + line.x1 * glyphWidth;
@@ -7,7 +7,6 @@ const GLYPH_WIDTH_RATIO = 0.62
7
7
  const LETTER_SPACING_RATIO = 0.3 // Letter spacing between characters (25% of glyph width)
8
8
  const SPACE_WIDTH_RATIO = 1
9
9
  const STROKE_WIDTH_RATIO = 0.13
10
- const CURVED_GLYPHS = new Set(["O", "o", "0"])
11
10
 
12
11
  export type AlphabetLayout = {
13
12
  width: number
@@ -125,23 +124,7 @@ export function strokeAlphabetText(
125
124
  const lines = getGlyphLines(char)
126
125
  const advance = char === " " ? spaceWidth : glyphWidth
127
126
 
128
- if (CURVED_GLYPHS.has(char)) {
129
- const normalizedCenterY = 0.5
130
- const centerY = topY + normalizedCenterY * height
131
- const radiusX = Math.max(glyphWidth / 2 - strokeWidth / 2, strokeWidth)
132
- const radiusY = Math.max(height / 2 - strokeWidth / 2, strokeWidth)
133
- ctx.beginPath()
134
- ctx.ellipse(
135
- cursor + glyphWidth / 2,
136
- centerY,
137
- radiusX,
138
- radiusY,
139
- 0,
140
- 0,
141
- Math.PI * 2,
142
- )
143
- ctx.stroke()
144
- } else if (lines?.length) {
127
+ if (lines?.length) {
145
128
  ctx.beginPath()
146
129
  for (const line of lines) {
147
130
  // Convert normalized y coordinates to canvas coordinates (inverted for canvas)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "circuit-to-canvas",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup-node ./lib/index.ts --format esm --dts",