(key, out)
| 165 | |
| 166 | |
| 167 | def custom_glyph(key, out): |
| 168 | x = (TILE - GLYPH_BOX) / 2 # glyph box left edge (30) |
| 169 | cx = TILE / 2 # 52 |
| 170 | cy = GLYPH_TOP + GLYPH_BOX / 2 # glyph box vertical center (40) |
| 171 | if key == "cfml": |
| 172 | # The community CFML mark: a <cf> tag, set in Archivo. |
| 173 | size, wt = 20.0, 700 |
| 174 | baseline = round(cy + out.cap_height(size, wt) / 2, 2) |
| 175 | d = out.centered("<cf>", size, wt, cx, baseline, track=0.4) |
| 176 | return f'<path fill="#1b5ea6" d="{d}"/>' |
| 177 | if key == "cobol": |
| 178 | # A punched card: manila stock, clipped corner, punched rows. |
| 179 | w, h = GLYPH_BOX, 28 |
| 180 | top, cut = round(cy - h / 2, 2), 7 |
| 181 | holes = [] |
| 182 | for row in range(3): |
| 183 | hy = top + 7.4 + row * 6.4 |
| 184 | for col in range(7): |
| 185 | if (row * 3 + col * 5) % 4 != 0: # deterministic "data" pattern |
| 186 | holes.append( |
| 187 | f'<rect x="{round(x + 4.4 + col * 5.4, 2)}" y="{round(hy, 2)}" width="2.4" height="4" fill="#6b5d33"/>' |
| 188 | ) |
| 189 | card = ( |
| 190 | f'M{x + cut},{top} H{x + w} V{top + h} H{x} V{top + cut} Z' |
| 191 | ) |
| 192 | return ( |
| 193 | f'<path d="{card}" fill="#ecdfb1" stroke="#b3a06a" stroke-width="1" stroke-linejoin="miter"/>' |
| 194 | + "".join(holes) |
| 195 | ) |
| 196 | if key == "vbnet": |
| 197 | # The .NET-purple badge with a VB monogram. |
| 198 | size, wt = 16.5, 720 |
| 199 | baseline = round(cy + out.cap_height(size, wt) / 2, 2) |
| 200 | d = out.centered("VB", size, wt, cx, baseline, track=0.6) |
| 201 | return ( |
| 202 | f'<rect x="{x}" y="{GLYPH_TOP}" width="{GLYPH_BOX}" height="{GLYPH_BOX}" rx="6" fill="#512bd4"/>' |
| 203 | f'<path fill="{PAPER}" d="{d}"/>' |
| 204 | ) |
| 205 | raise KeyError(key) |
| 206 | |
| 207 | |
| 208 | def main(): |
no test coverage detected