@kabmo-labs/kabmo 0.30.0 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/static/js/{index-5vjbp04s.js → index-bwhhehnh.js} +588 -588
- package/package.json +1 -1
- package/src/shared/lib/fonts/nerd-symbols.css +14 -0
- package/src/shared/lib/fonts/nerd-symbols.test.ts +86 -0
- package/src/shared/lib/fonts/symbols-nerd-font-mono.woff2 +0 -0
package/package.json
CHANGED
|
@@ -36,6 +36,20 @@
|
|
|
36
36
|
* Generated by `bun run scripts/nerd-symbols-font.mjs` from
|
|
37
37
|
* `SymbolsNerdFontMono-Regular.ttf` (Nerd Fonts v3.5.1). See NOTICE.md in this
|
|
38
38
|
* directory for the icon-set licences.
|
|
39
|
+
*
|
|
40
|
+
* The powerline separators (U+E0B0-E0B7) are mapped onto the terminal's CELL
|
|
41
|
+
* BOX by that script, not left at upstream's one em. The cell is 15 px tall at
|
|
42
|
+
* a 12 px font (the text face's ink plus the block padding in
|
|
43
|
+
* `terminal-panel/fonts.ts`) and 8 px wide, while upstream draws the glyphs
|
|
44
|
+
* inside a 0.6 em design cell with a 1 em advance. Two defects followed, both
|
|
45
|
+
* only on a phone (a machine with a real Nerd Font draws to its own ~1.2 em
|
|
46
|
+
* line box and looks right): a separator ended 1.5 px above and below the
|
|
47
|
+
* coloured run it terminates, so a rounded end read as a small semicircle
|
|
48
|
+
* floating inside a taller rectangle; and a right-aligned glyph — a segment's
|
|
49
|
+
* START cap — sat at 0.4-1.0 em, past the 0.667 em cell, where it was clipped
|
|
50
|
+
* to a sliver. The transform maps the ink to the cell box vertically and the
|
|
51
|
+
* design cell onto the real cell horizontally; `nerd-symbols.test.ts` pins
|
|
52
|
+
* both.
|
|
39
53
|
*/
|
|
40
54
|
|
|
41
55
|
@font-face {
|
|
@@ -144,6 +144,92 @@ print(json.dumps({ "codepoints": len(cmap), "uncovered": uncovered, "missing": [
|
|
|
144
144
|
expect(file.size).toBeGreaterThan(100_000);
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* The powerline separators must fill the terminal's CELL BOX, not one em.
|
|
149
|
+
*
|
|
150
|
+
* Upstream draws them one em tall, but the cell is 15 px at a 12 px font
|
|
151
|
+
* (the text face's ink plus the block padding in `terminal-panel/fonts.ts`),
|
|
152
|
+
* so a separator ended 1.5 px above and below the coloured run it terminates:
|
|
153
|
+
* the rounded end of a prompt segment read as a small semicircle floating
|
|
154
|
+
* inside a taller rectangle. A machine with a real Nerd Font never saw it —
|
|
155
|
+
* that face draws to its own ~1.2 em line box — so the defect only appeared
|
|
156
|
+
* on a phone, where the bundled face is the one that renders.
|
|
157
|
+
*
|
|
158
|
+
* The box is stated here rather than imported: `measureTerminalCell` needs a
|
|
159
|
+
* canvas, and this test runs in Bun. The numbers are the ones that function
|
|
160
|
+
* produces for 12 px Fira Code, and `scripts/nerd-symbols-font.mjs` maps the
|
|
161
|
+
* glyphs onto the same box.
|
|
162
|
+
*/
|
|
163
|
+
test('the powerline separators fill the terminal cell box', () => {
|
|
164
|
+
const available = Bun.spawnSync({
|
|
165
|
+
cmd: ['python3', '-c', 'import fontTools, brotli'],
|
|
166
|
+
timeout: 5_000,
|
|
167
|
+
});
|
|
168
|
+
if (available.exitCode !== 0) {
|
|
169
|
+
console.warn('skipping powerline cell-box check: python3 fonttools/brotli unavailable');
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const probe = Bun.spawnSync([
|
|
174
|
+
'python3',
|
|
175
|
+
'-c',
|
|
176
|
+
`
|
|
177
|
+
import json
|
|
178
|
+
from fontTools.ttLib import TTFont
|
|
179
|
+
from fontTools.pens.boundsPen import BoundsPen
|
|
180
|
+
|
|
181
|
+
font = TTFont(${JSON.stringify(WOFF2)})
|
|
182
|
+
upm = font['head'].unitsPerEm
|
|
183
|
+
units_per_px = upm / 12.0
|
|
184
|
+
top = 11 * units_per_px
|
|
185
|
+
bottom = (11 - 15) * units_per_px
|
|
186
|
+
cell_width = 8 * units_per_px
|
|
187
|
+
glyf = font['glyf']
|
|
188
|
+
cmap = font.getBestCmap()
|
|
189
|
+
bounds = {}
|
|
190
|
+
for cp in range(0xE0B0, 0xE0B8):
|
|
191
|
+
name = cmap.get(cp)
|
|
192
|
+
if name is None:
|
|
193
|
+
continue
|
|
194
|
+
pen = BoundsPen(None)
|
|
195
|
+
glyf[name].draw(pen, glyf)
|
|
196
|
+
bounds[hex(cp)] = pen.bounds
|
|
197
|
+
print(json.dumps({ 'top': top, 'bottom': bottom, 'cellWidth': cell_width, 'upm': upm, 'bounds': bounds }))
|
|
198
|
+
`,
|
|
199
|
+
]);
|
|
200
|
+
|
|
201
|
+
expect(probe.stderr.toString()).toBe('');
|
|
202
|
+
const result = JSON.parse(probe.stdout.toString()) as {
|
|
203
|
+
top: number;
|
|
204
|
+
bottom: number;
|
|
205
|
+
cellWidth: number;
|
|
206
|
+
upm: number;
|
|
207
|
+
bounds: Record<string, [number, number, number, number]>;
|
|
208
|
+
};
|
|
209
|
+
// Every separator is present, and each one's ink spans the cell box.
|
|
210
|
+
expect(Object.keys(result.bounds).length).toBe(8);
|
|
211
|
+
const em = result.upm;
|
|
212
|
+
for (const [codepoint, bounds] of Object.entries(result.bounds)) {
|
|
213
|
+
expect({ codepoint, bottom: Math.round(bounds[1]) }).toEqual({
|
|
214
|
+
codepoint,
|
|
215
|
+
bottom: Math.round(result.bottom),
|
|
216
|
+
});
|
|
217
|
+
expect({ codepoint, top: Math.round(bounds[3]) }).toEqual({
|
|
218
|
+
codepoint,
|
|
219
|
+
top: Math.round(result.top),
|
|
220
|
+
});
|
|
221
|
+
// Horizontal: the ink must sit AT the cell's left edge, not 0.4 em into
|
|
222
|
+
// it. A right-aligned glyph left at its design position was clipped to a
|
|
223
|
+
// sliver on a phone — the front cap of the prompt line.
|
|
224
|
+
expect({ codepoint, left: bounds[0] < 0.15 * em }).toEqual({ codepoint, left: true });
|
|
225
|
+
expect({ codepoint, right: bounds[2] > 0.5 * em }).toEqual({ codepoint, right: true });
|
|
226
|
+
expect({ codepoint, right: bounds[2] < result.cellWidth + 0.15 * em }).toEqual({
|
|
227
|
+
codepoint,
|
|
228
|
+
right: true,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}, 20_000);
|
|
232
|
+
|
|
147
233
|
/**
|
|
148
234
|
* The UI stack is the SECOND consumer of this face, and it was missing one.
|
|
149
235
|
* omp heads a session title with a card icon — a PUA glyph
|
|
Binary file
|