From 7cc9057413246891536d2d2694eb0d4512352e10 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Mon, 7 Sep 2026 21:34:52 -0400 Subject: [PATCH] Preserve named font metadata and exercise glyph maintenance Keep the baseline glyph names and add Cursor with compatible format-2 post and format-12 cmap tables. Exercise listing, disposable SVG addition and occupied-codepoint rejection. --- default/fonts/omarchy/omarchy.ttf | Bin 5012 -> 5412 bytes test/shell.d/release-ai-port-test.sh | 55 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/default/fonts/omarchy/omarchy.ttf b/default/fonts/omarchy/omarchy.ttf index c6b76994effec2b771f1a38be1bbff2c00ce63a3..2172c05e78afd88d2bfb91fa88e8bd9e7fdb4093 100644 GIT binary patch delta 596 zcmXYtv1`;|7{;GB$>nm_>$O*}x;Qup1wr9x5eIQmTYwm8|pK$PI%;^H9qyk`Qx{PMhC@_z4^+1lG{hlA<)-JgKGB&XZy z_HP-;{G{>W(8lO&TnzX5LXM0esUrML(~@r20;TLKO#4=qJUAIaRZPK zGG8GtF*o(>^Ji0l{1reuPZ#7Dm+&y~0;L#)OF#-H?m5rN$iU3N2;}fgp2N6vb11Vl WAIs~bCUKjm2)<-uWS(3nA_oA|XfRCx diff --git a/test/shell.d/release-ai-port-test.sh b/test/shell.d/release-ai-port-test.sh index 7521f1a5..d90695c8 100644 --- a/test/shell.d/release-ai-port-test.sh +++ b/test/shell.d/release-ai-port-test.sh @@ -65,3 +65,58 @@ pass "baseline mise setup tolerates an unfinished Hermes Desktop and disables pr PATH="$test_tmp/bin:$PATH" bash -euo pipefail "$ROOT/migrations/1787215483.sh" >/dev/null grep -qx 'mise:settings set upgrade.auto_prune false' "$TEST_CALLS" || fail "existing users retain running mise versions" pass "mise migration applies the same no-pruning setting" + +# Exercise the documented font workflow, not just fontconfig's charset reader. +# Work on a disposable copy: adding a fixture must never edit the source font. +python3 - "$ROOT" "$test_tmp" <<'PY' +import pathlib +import runpy +import shutil +import struct +import subprocess +import sys + +root, temporary = map(pathlib.Path, sys.argv[1:]) +tool = root / 'bin/omarchy-dev-font' +font = temporary / 'omarchy.ttf' +shutil.copyfile(root / 'default/fonts/omarchy/omarchy.ttf', font) +api = runpy.run_path(str(tool)) + +def snapshot(): + data, tables, count = api['load_font'](str(font)) + offsets = api['read_loca'](data, tables, count) + names = api['read_names'](data, tables['post'][0], count) + cmap = api['read_cmap'](data, tables['cmap'][0]) + start = tables['glyf'][0] + glyphs = [data[start + offsets[i]:start + offsets[i + 1]].rstrip(b'\0') for i in range(count)] + metrics = data[tables['hmtx'][0]:sum(tables['hmtx'])] + assert struct.unpack_from('>I', data, tables['post'][0])[0] == 0x20000 + return names, cmap, glyphs, metrics + +before = snapshot() +assert before[0][before[1][0xE90D]] == 'cursor' +assert 0xE909 not in before[1] +listing = subprocess.check_output([sys.executable, str(tool), 'list', '--font', str(font)], text=True) +for cp, name, _ in api['glyph_list'](str(font)): + assert f'U+{cp:04X}' in listing and name in listing +assert 'U+E90D' in listing and 'cursor' in listing +print('ok - the shipped font lists its named Cursor mark through the real font tool') + +svg = temporary / 'fixture.svg' +svg.write_text('') +subprocess.run([sys.executable, str(tool), 'add', 'release-fixture', str(svg), '--font', str(font)], check=True, stdout=subprocess.DEVNULL) +after = snapshot() +assert after[0] == before[0] + ['release-fixture'] +assert after[1] == before[1] | {0xE90E: len(before[0])} +assert after[2][:-1] == before[2] +assert after[3].startswith(before[3]) +print('ok - adding a local SVG preserves every existing name, codepoint, outline and metric') +listing = subprocess.check_output([sys.executable, str(tool), 'list', '--font', str(font)], text=True) +assert 'U+E90E' in listing and 'release-fixture' in listing and 'cursor' in listing +print('ok - the real font tool lists the newly added disposable glyph') +unchanged = font.read_bytes() +result = subprocess.run([sys.executable, str(tool), 'add', 'collision', str(svg), '--codepoint', 'E90D', '--font', str(font)], capture_output=True, text=True) +assert result.returncode != 0 and 'already used' in result.stderr +assert font.read_bytes() == unchanged +print('ok - adding over Cursor is rejected without changing the font') +PY