circuit-to-svg 0.0.285 → 0.0.286
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 +10 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2750,6 +2750,7 @@ import { lineAlphabet } from "@tscircuit/alphabet";
|
|
|
2750
2750
|
var CHAR_WIDTH = 1;
|
|
2751
2751
|
var CHAR_SPACING = 0.2;
|
|
2752
2752
|
var LINE_HEIGHT = 1.4;
|
|
2753
|
+
var FONT_SCALE = 0.53;
|
|
2753
2754
|
function linesToPathData(lines, offsetX, offsetY, charScale) {
|
|
2754
2755
|
return lines.map((line) => {
|
|
2755
2756
|
const x1 = offsetX + line.x1 * charScale;
|
|
@@ -2841,15 +2842,16 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
|
|
|
2841
2842
|
const isBottom = layerName === "bottom";
|
|
2842
2843
|
const applyMirror = isBottom ? true : is_mirrored === true;
|
|
2843
2844
|
if (is_knockout) {
|
|
2845
|
+
const scaledFontSize2 = fontSizeNum * FONT_SCALE;
|
|
2844
2846
|
const { pathData: pathData2, width: width2, height: height2 } = textToCenteredAlphabetPaths(
|
|
2845
2847
|
text,
|
|
2846
|
-
|
|
2848
|
+
scaledFontSize2
|
|
2847
2849
|
);
|
|
2848
|
-
const padX = knockout_padding?.left ??
|
|
2849
|
-
const padY = knockout_padding?.top ??
|
|
2850
|
+
const padX = knockout_padding?.left ?? scaledFontSize2 * 0.5;
|
|
2851
|
+
const padY = knockout_padding?.top ?? scaledFontSize2 * 0.3;
|
|
2850
2852
|
const rectW = width2 + padX * 2;
|
|
2851
2853
|
const rectH = height2 + padY * 2;
|
|
2852
|
-
const strokeWidth2 =
|
|
2854
|
+
const strokeWidth2 = scaledFontSize2 * 0.15;
|
|
2853
2855
|
const knockoutTransform = matrixToString4(
|
|
2854
2856
|
compose3(
|
|
2855
2857
|
translate3(ax, ay),
|
|
@@ -2927,9 +2929,10 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
|
|
|
2927
2929
|
}
|
|
2928
2930
|
];
|
|
2929
2931
|
}
|
|
2932
|
+
const scaledFontSize = fontSizeNum * FONT_SCALE;
|
|
2930
2933
|
const { pathData, width, height } = textToCenteredAlphabetPaths(
|
|
2931
2934
|
text,
|
|
2932
|
-
|
|
2935
|
+
scaledFontSize
|
|
2933
2936
|
);
|
|
2934
2937
|
let offsetX = 0;
|
|
2935
2938
|
let offsetY = 0;
|
|
@@ -2972,7 +2975,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
|
|
|
2972
2975
|
scale2(scaleFactor, scaleFactor)
|
|
2973
2976
|
)
|
|
2974
2977
|
);
|
|
2975
|
-
const strokeWidth =
|
|
2978
|
+
const strokeWidth = scaledFontSize * 0.15;
|
|
2976
2979
|
return [
|
|
2977
2980
|
{
|
|
2978
2981
|
name: "path",
|
|
@@ -5499,7 +5502,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5499
5502
|
var package_default = {
|
|
5500
5503
|
name: "circuit-to-svg",
|
|
5501
5504
|
type: "module",
|
|
5502
|
-
version: "0.0.
|
|
5505
|
+
version: "0.0.285",
|
|
5503
5506
|
description: "Convert Circuit JSON to SVG",
|
|
5504
5507
|
main: "dist/index.js",
|
|
5505
5508
|
files: [
|