Skip to content

Fix 0.3.0 export bugs: net labels, legend, data-net, symbol glyphs - #50

Merged
xtofalex merged 1 commit into
mainfrom
fix-0.3.0-export-bugs
Nov 14, 2026
Merged

xtofalex merged 1 commit into
mainfrom
fix-0.3.0-export-bugs

Conversation

@xtofalex

Copy link
Copy Markdown
Contributor

Fixes four bugs in the 0.3.0 export features, found rendering a fanout-fix report (naja-schematic render ... --style ... --legend --png).

Fixes

  • Net labels drawn over boxes and port flags. A style's label on a net is now drawn above the wire right past its driver pin, in room the layout makes for it (SchematicLayout::netLabelPlaces()): part of the driver's footprint and a routing obstacle, pushed past the instance name when level with its row. Top-level input ports move left so their label sits between the flag and the wire's channel. Same placement on screen, in SVG and in PNG.
  • Legend listed colors drawn nowhere. It now lists the colors actually drawn, one entry per net: the style's label and color when a style labels it, else the trace's; no duplicates. The demo goes from 8 entries (4 of them trace colors overridden by the style) to 4.
  • data-net held the driver's pin name (O). It's now the net's name at the driver's level (en_q; name[bit] for a bus bit; n inside u_sub across hierarchy). Both hosts now send "net"/"net_id" on every equipotential pin (setNet() in LocalSNLProvider.cpp, net_fields() in protocol.py); older hosts fall back to the pin label.
  • → drawn as the replacement glyph in PNGs. Not a glyph-range issue (glyphs load on demand): DroidSans has no arrows. A 53 KB subset of DejaVu Sans (arrows, math operators, punctuation, letterlike symbols, geometric shapes, ✓/✗) is merged into the default font (src/AppFont.cpp, src/SymbolFont.h).

Also fixed: a net style item was anchored on any top-level port of the net, including an output port, which a trace's partial net doesn't list, so styling a traced net ending at an output port silently did nothing. It's now sent on the net's driver.

Licensing

src/SymbolFont.h brings in DejaVu's license, added verbatim as LICENSES/LicenseRef-DejaVu-Fonts.txt (Bitstream Vera + Arev, DejaVu changes in the public domain). reuse lint passes.

Tests

  • Python (test_render.py, new data fanout_fix.v + style): net label boxes don't overlap any box, port flag or each other (fanout demo and a gate design); legend colors == drawn net colors, with and without a style; data-net names on the demo, across hierarchy and for bus bits; a PNG with → and other symbols differs from one with a character no font has.
  • C++: label placement and footprint (SchematicLayoutTest), "net"/"net_id" parsing (TypesJsonTest), and on the real view with the app font (SvgExportTest): labels vs boxes/names/flags/trunks, legend, data-net, every exported character has a glyph.

Locally: 256 Python tests (renderer required), 311 + 14 C++ tests pass. Not run locally: test_notebook.py, the WASM build.

Net labels: a style's label on a net is drawn above the wire right past
its driver pin, in room the layout makes for it
(SchematicLayout::netLabelPlaces(), Port::netLabel): part of the driver's
footprint and a routing obstacle, pushed past the instance name when
level with its row. Input ports move left so their label sits between
the flag and the wire's channel. Never under a box, a name, a flag or a
trunk; the same on screen, in SVG and PNG.

Legend: lists the colors actually drawn, one entry per wire tree: the
style's label and color when a style labels it, else the trace's (each
trace of a striped tree); no duplicates, nothing for an unlabeled or
faint wire. A style no longer leaves its trace's color in the legend.

data-net: a wire tree is named by its driver's net at the driver's level
(bus bits as name[bit]), not the driver pin's name. Every equipotential
pin carries "net"/"net_id" from both hosts (setNet() in
LocalSNLProvider.cpp, net_fields() in protocol.py); older hosts fall
back to the pin label.

Glyphs: DroidSans has no arrows; a subset of DejaVu Sans (arrows, math
operators, punctuation, letterlike symbols, geometric shapes) is merged
into the default font (AppFont.cpp, SymbolFont.h,
LICENSES/LicenseRef-DejaVu-Fonts.txt), so "→" no longer draws the
replacement glyph in PNG exports or on screen.

Style resolution: a net item is sent on its net's driver (a top-level
input port, else an output leaf pin), not on an output port, which a
trace's partial net doesn't list -- styling a traced net ending at an
output port did nothing.

Tests: label boxes vs boxes/names/flags/trunks, legend == drawn colors,
data-net on a fanout-fix demo and across hierarchy, every exported
character has a glyph (C++), a PNG with symbols differs from the
replacement glyph (Python).
@xtofalex
xtofalex merged commit 3beb955 into main Nov 14, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant