From b5970f942b56928fe1fd95480af690f31baca029 Mon Sep 17 00:00:00 2001 From: Thea Flowers Date: Fri, 3 Nov 2023 12:53:33 -0400 Subject: [PATCH] Unescape text used in labels Fixes #45 Fixes #43 --- src/kicad/schematic.ts | 5 +++++ src/viewers/schematic/painters/label.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/kicad/schematic.ts b/src/kicad/schematic.ts index a055660f..e88a02f6 100644 --- a/src/kicad/schematic.ts +++ b/src/kicad/schematic.ts @@ -15,6 +15,7 @@ import { Stroke, TitleBlock, expand_text_vars, + unescape_string, } from "./common"; import { P, T, parse_expr, type Parseable } from "./parser"; @@ -685,6 +686,10 @@ export class Label { P.atom("fields_autoplaced"), P.pair("uuid", T.string), ]; + + get shown_text() { + return unescape_string(this.text); + } } export class NetLabel extends Label { diff --git a/src/viewers/schematic/painters/label.ts b/src/viewers/schematic/painters/label.ts index 3578422d..4f0c541d 100644 --- a/src/viewers/schematic/painters/label.ts +++ b/src/viewers/schematic/painters/label.ts @@ -38,7 +38,7 @@ export class LabelPainter extends SchematicItemPainter { return; } - const schtext = new SchText(l.text); + const schtext = new SchText(l.shown_text); schtext.apply_at(l.at); schtext.apply_effects(l.effects);