diff --git a/CLAUDE.md b/CLAUDE.md index 265cf0c..6f52b01 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -147,6 +147,7 @@ than matching the format again elsewhere. - File search uses `fs.WalkDir` from `./` and does NOT follow symlinks - Hooks use `/bin/sh -c` (Linux/macOS only) - `gocsv` library handles CSV marshal/unmarshal via struct tags -- `scripts/gen-logo.py` regenerates `gitplm-logo.svg` and - `gitplm-logo-square.svg` from Fira Code glyph outlines (fontTools); its - docstring has the `rsvg-convert` commands for the PNG derivatives +- `scripts/gen-logo.py` regenerates `gitplm-logo.svg`, `gitplm-logo-square.svg`, + and the `[g]` favicon source `gitplm-icon.svg` from Fira Code glyph outlines + (fontTools); its docstring has the `rsvg-convert` commands for the PNG + derivatives, including `favicon.png` diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..789a06f Binary files /dev/null and b/favicon.png differ diff --git a/gitplm-icon.svg b/gitplm-icon.svg new file mode 100644 index 0000000..caa8000 --- /dev/null +++ b/gitplm-icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/kicad_api.go b/kicad_api.go index 9926332..469a747 100644 --- a/kicad_api.go +++ b/kicad_api.go @@ -267,7 +267,7 @@ func (s *KiCadServer) getCategoryDisplayName(category string) string { "RES": "Resistors", "RFM": "RF Modules", "SWI": "Switches", - "XTR": "Transceivers", + "XTR": "Transistors/FETs", "LED": "LEDs", "SCR": "Screws", "MCH": "Mechanical", @@ -321,7 +321,7 @@ func (s *KiCadServer) getCategoryDescription(category string) string { "RES": "Resistor components", "RFM": "RF module components", "SWI": "Switch components", - "XTR": "Transceiver components", + "XTR": "Transistor and FET components", "LED": "Light emitting diode components", "SCR": "Screw and fastener components", "MCH": "Mechanical components", diff --git a/scripts/gen-logo.py b/scripts/gen-logo.py index fd9dd16..d7fb76a 100644 --- a/scripts/gen-logo.py +++ b/scripts/gen-logo.py @@ -4,10 +4,16 @@ SVG) using Fira Code Medium, in phosphor green on black like a classic CRT terminal. +Outputs: + gitplm-logo.svg wide wordmark (README header) + gitplm-logo-square.svg square wordmark (og:image / social previews) + gitplm-icon.svg square [g] icon (favicons, small sizes) + Usage: python scripts/gen-logo.py rsvg-convert -w 400 gitplm-logo.svg -o gitplm-logo.png rsvg-convert -w 360 -h 360 gitplm-logo-square.svg -o gitplm-logo-square.png + rsvg-convert -w 64 -h 64 gitplm-icon.svg -o favicon.png Requires fontTools and the Fira Code font (path below). """ @@ -30,22 +36,22 @@ cmap = font.getBestCmap() glyphs = font.getGlyphSet() -# Build one combined path, y-flipped (font coords -> SVG coords), advancing x. -pen = SVGPathPen(glyphs) -bpen = BoundsPen(glyphs) -x = 0 -for ch in TEXT: - g = glyphs[cmap[ord(ch)]] - t = Transform(1, 0, 0, -1, x, 0) - g.draw(TransformPen(pen, t)) - g.draw(TransformPen(bpen, t)) - x += g.width -path = pen.getCommands() -xmin, ymin, xmax, ymax = bpen.bounds -w, h = xmax - xmin, ymax - ymin +def text_path(text): + """Combined outline path, y-flipped (font coords -> SVG coords), plus bounds.""" + pen = SVGPathPen(glyphs) + bpen = BoundsPen(glyphs) + x = 0 + for ch in text: + g = glyphs[cmap[ord(ch)]] + t = Transform(1, 0, 0, -1, x, 0) + g.draw(TransformPen(pen, t)) + g.draw(TransformPen(bpen, t)) + x += g.width + return pen.getCommands(), bpen.bounds -def svg(width, height, scale, tx, ty): + +def svg(path, width, height, scale, tx, ty): return f""" @@ -56,19 +62,35 @@ def svg(width, height, scale, tx, ty): """ +def square(path, bounds, frac): + """360x360 square with the text scaled to frac of the width, centered.""" + xmin, ymin, xmax, ymax = bounds + w, h = xmax - xmin, ymax - ymin + SQ = 360 + s = (SQ * frac) / w + tx = (SQ - w * s) / 2 - xmin * s + ty = (SQ - h * s) / 2 - ymin * s + return svg(path, SQ, SQ, s, tx, ty) + + +path, bounds = text_path(TEXT) +xmin, ymin, xmax, ymax = bounds +w, h = xmax - xmin, ymax - ymin + # Wide wordmark, normalized to 100 px tall. pad = 0.30 * h s = 100.0 / (h + 2 * pad) W = round((w + 2 * pad) * s, 2) (ROOT / "gitplm-logo.svg").write_text( - svg(W, 100, s, (pad - xmin) * s, (pad - ymin) * s) + svg(path, W, 100, s, (pad - xmin) * s, (pad - ymin) * s) ) print(f"wrote gitplm-logo.svg {W} x 100") # Square logo: 360x360, text ~85% of width, centered. -SQ = 360 -s2 = (SQ * 0.85) / w -tx = (SQ - w * s2) / 2 - xmin * s2 -ty = (SQ - h * s2) / 2 - ymin * s2 -(ROOT / "gitplm-logo-square.svg").write_text(svg(SQ, SQ, s2, tx, ty)) +(ROOT / "gitplm-logo-square.svg").write_text(square(path, bounds, 0.85)) print("wrote gitplm-logo-square.svg 360x360") + +# [g] icon for favicons -- a full wordmark is unreadable at tab size. +ipath, ibounds = text_path("[g]") +(ROOT / "gitplm-icon.svg").write_text(square(ipath, ibounds, 0.72)) +print("wrote gitplm-icon.svg 360x360")