Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Binary file added favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions gitplm-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions kicad_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
62 changes: 42 additions & 20 deletions scripts/gen-logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
"""
Expand All @@ -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"""<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {width} {height}" width="{width}" height="{height}">
<rect width="{width}" height="{height}" fill="{BG}"/>
Expand All @@ -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")
Loading