Skip to content

Commit 94d84f5

Browse files
committed
Use KiCad property text sizes
1 parent 25bae7b commit 94d84f5

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

src/convert-kicad-json-to-tscircuit-soup.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -775,20 +775,6 @@ export const convertKicadJsonToTsCircuitSoup = async (
775775
pcbComponent.width = componentWidth
776776
pcbComponent.height = componentHeight
777777

778-
const computeDynamicFontSize = () => {
779-
const baseFontSize = 1.27
780-
const usableDimensions = [componentWidth, componentHeight].filter(
781-
(value) => Number.isFinite(value) && value > 0,
782-
)
783-
784-
if (usableDimensions.length === 0) return baseFontSize
785-
786-
const smallestDimension = Math.min(...usableDimensions)
787-
const scaled = smallestDimension * 0.4
788-
789-
return Math.max(Math.min(scaled, baseFontSize), 0.3)
790-
}
791-
792778
for (const fp_text of fp_texts) {
793779
const layerRef = convertKicadLayerToTscircuitLayer(fp_text.layer)!
794780

@@ -830,7 +816,8 @@ export const convertKicadJsonToTsCircuitSoup = async (
830816
const propLayer = propFab!.attributes.layer?.toLowerCase()
831817
const isFabLayer = propLayer?.endsWith(".fab")
832818

833-
const font_size = computeDynamicFontSize()
819+
const font_size =
820+
propFab!.attributes?.effects?.font?.size?.[0] ?? 1.27
834821

835822
circuitJson.push({
836823
type: isFabLayer ? "pcb_fabrication_note_text" : "pcb_silkscreen_text",
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)