The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
"""The Focus skin's generated proportional faces, converted with lv_font_conv.
python3 devices/harness-device/firmware/scripts/gen_focus_faces.py [--inter-instance]
Writes main/ui/habitat/focus_faces.c and focus_faces.h. Focus sets every word and number in Inter at its text
optical size (owner, 2026-10-03: SF Compact's open look-alike; docs/plans/2026-10-03-inter-sf-compact.md), in
five faces: inter_20 (small labels, the PANES / TABS header, inbox machine and agent, the bell count), inter_25
(an inbox message, the "Choose a tab" pill), inter_med_26 (the curved name and the lower-arc status and Listening
sweep), inter_28 / inter_44 (the tabs carousel's neighbours and chosen tab), inter_30 (the recap, pane and tab names,
the working status) and inter_36 (the resting line), and the wordmark inter_bold_48: "Harness" while the dial connects,
cut to its six letters (WORDMARK).
Only the two FontAwesome symbols (bell, close cross) stay in lvgl_fonts.c's Montserrat, which
gen_lvgl_assets.py cuts to them. Each face is converted as the LVGL faces were: lv_font_conv
(pinned, run through npx) with --bpp 4 --no-compress --no-prefilter, kerning on, over gen_lvgl_assets.py's
TEXT codepoints, then parsed with that script's lv_font() / emit_font(). Inter has no check / cross
marks (U+2713 / U+2717), so each face takes those two codepoints from Noto Sans Symbols 2 (OFL 1.1, vendored
as fonts/NotoSansSymbols2-Regular.ttf with fonts/NotoSansSymbols2-OFL.txt) through a second --font.
Inter (OFL 1.1, fonts/Inter-OFL.txt): fonts/Inter-Regular20.ttf, -Regular25, -Regular30 and -Regular36 (opsz 14,
wght 450), -Medium26 (opsz 14, wght 520) and -Bold48 (opsz 28, wght 700) are static instances of the variable
mockup/fonts-inter/Inter.ttf (github.com/google/fonts ofl/inter, Inter[opsz,wght].ttf), each
cut down to the TEXT codepoints and kern feature, its kerning lookups unwrapped from GPOS Extension (type 9)
subtables, which lv_font_conv does not read (without them the face comes out unkerned). `--inter-instance`
re-cuts them (INTER). The default run reads the vendored files and needs node and fontTools (pip install
fonttools: it reads each font's coverage).
"""
import re
import subprocess
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
import gen_lvgl_assets as base # noqa: E402 (importing has no side effects; its main() is guarded)
root = base.root
LV_FONT_CONV = '[email protected]'
FONTS = root / 'fonts'
# Inter has no check / cross marks; they come from Noto Sans Symbols 2 (OFL, vendored), so recaps keep showing them.
MARKS = {0x2713, 0x2717}
MARKS_FONT = FONTS / 'NotoSansSymbols2-Regular.ttf' # github.com/google/fonts ofl/notosanssymbols2
KEEP = base.TEXT
assert MARKS <= KEEP
# name -> (font file in fonts/, px, fallback face).
# Inter instances: file stem -> (opsz, wght). The text optical size everywhere (SF Compact Text's look-alike);
# 450 / 520 match SF Compact Text Regular / Medium widths.
INTER = {'Inter-Regular20': (14, 450), 'Inter-Regular25': (14, 450), 'Inter-Medium26': (14, 520),
'Inter-Regular30': (14, 450), 'Inter-Regular36': (14, 450),
'Inter-Bold48': (28, 700)} # opsz 28: the design's 184 px "Harness" at 48 px bold (design 2026-10-06)
# The curved Inter name's mid-caps offset on the upper arc (px above the baseline); terminal.c's ARC_PROP_MID is 11.
INTER_ARC_MID = 16
# On the lower arc the glyphs are upright and the descenders point at the glass's edge, so the face keeps the
# default offset there (the stacked marks of a capital point inward).
INTER_ARC_MID_LOWER = 11
FACES = [
('inter_20', 'Inter-Regular20', 20, 'NULL'), # small labels: PANES / TABS, inbox machine and agent, the bell count
('inter_25', 'Inter-Regular25', 25, 'NULL'), # an inbox message, the "Choose a tab" pill
('inter_med_26', 'Inter-Medium26', 26, 'NULL'), # the curved name, the lower-arc status and the Listening sweep
('inter_28', 'Inter-Regular30', 28, 'NULL'), # the tabs carousel's neighbours (design 2026-10-06)
('inter_30', 'Inter-Regular30', 30, 'NULL'), # the recap (Kindle dark layout), pane and tab names, the working status
('inter_44', 'Inter-Regular30', 44, 'NULL'), # the tabs carousel's chosen tab (design 2026-10-06: 1.5x of 28-30)
('inter_36', 'Inter-Regular36', 36, 'NULL'), # the resting line
]
# Faces that set one word: name -> (font file, px, the word). Only its letters (and the space) are kept.
WORDMARK = [('inter_bold_48', 'Inter-Bold48', 48, 'Harness')] # while the dial connects (design 2026-10-06)
def instance_inter():
for stem, (opsz, wght) in INTER.items():
instance_inter_one(stem, opsz, wght)
def instance_inter_one(stem, opsz, wght):
from fontTools import subset
from fontTools.ttLib import TTFont
from fontTools.varLib import instancer
font = instancer.instantiateVariableFont(TTFont(root / 'mockup/fonts-inter/Inter.ttf'),
{'opsz': opsz, 'wght': wght})
options = subset.Options()
options.layout_features, options.name_IDs, options.notdef_outline = ['kern'], ['*'], True
subsetter = subset.Subsetter(options)
subsetter.populate(unicodes=sorted(KEEP))
subsetter.subset(font)
with tempfile.TemporaryDirectory() as t: # a saved and reloaded font shows its Extension wrappers
font.save(Path(t) / 'l.ttf')
font = TTFont(Path(t) / 'l.ttf')
for lookup in font['GPOS'].table.LookupList.Lookup:
if lookup.LookupType == 9:
lookup.LookupType = lookup.SubTable[0].ExtensionLookupType
lookup.SubTable = [sub.ExtSubTable for sub in lookup.SubTable]
font.save(FONTS / f'{stem}.ttf')
def ranges(codes):
"""Sorted codepoints as lv_font_conv -r arguments: runs a-b, singles a."""
out, codes = [], sorted(codes)
i = 0
while i < len(codes):
j = i
while j + 1 < len(codes) and codes[j + 1] == codes[j] + 1:
j += 1
out.append(f'0x{codes[i]:X}' + (f'-0x{codes[j]:X}' if j > i else ''))
i = j + 1
return ','.join(out)
def covered(source):
"""The TEXT codepoints the font really has. A requested range with a hole makes lv_font_conv emit a
format-0-full cmap, which lv_font() does not read; a face holds only what its font draws (a rare
letter it lacks falls to '?')."""
from fontTools.ttLib import TTFont
return (KEEP - MARKS) & set(TTFont(FONTS / f'{source}.ttf').getBestCmap())
def convert(source, px, tmp, name):
out = tmp / f'{name}.c'
subprocess.run(['npx', '-y', LV_FONT_CONV, '--size', str(px), '--bpp', '4', '--format', 'lvgl',
'--no-compress', '--no-prefilter', '--force-fast-kern-format',
'--font', str(FONTS / f'{source}.ttf'), '-r', ranges(covered(source)),
'--font', str(MARKS_FONT), '-r', ranges(MARKS),
'--lv-include', 'lvgl.h', '-o', str(out)], check=True, capture_output=True, text=True)
return out.read_text()
def main():
if '--inter-instance' in sys.argv:
instance_inter()
c = ['// Generated by scripts/gen_focus_faces.py. Do not edit.\n'
f'// Inter (OFL 1.1) through {LV_FONT_CONV}: --bpp 4 --no-compress --no-prefilter.\n'
'#include "terminal.h"\n']
h = ['// Generated by scripts/gen_focus_faces.py. Do not edit.\n#pragma once\n#include "terminal.h"\n']
total = 0
with tempfile.TemporaryDirectory() as t:
for name, source, px, fallback in FACES:
font = base.lv_font(convert(source, px, Path(t), name))
code, size = base.emit_font(name, font, KEEP, fallback)
c.append(code)
h.append(f'extern const ht_pfont_t ht_lv_{name};\n')
# Self-check: every TEXT codepoint the font has, the marks and the 98 Vietnamese letters were
# kept, and the metrics are sane.
m = re.search(rf'static const uint16_t {name}_codes\[\] = \{{(.*?)\}};', code)
codes = {int(v) for v in m.group(1).split(',')}
missing = (covered(source) | MARKS) - codes
assert not missing, (name, sorted(missing))
assert len(set(range(0x1EA0, 0x1EFA)) & codes) == 90 and {0x1A0, 0x1A1, 0x1AF, 0x1B0} <= codes
assert 0 < font['line'] - font['base'] < font['line'], name
total += size
print(f'{name}: {len(codes)} glyphs, line {font["line"]}, ascent {font["line"] - font["base"]},'
f' {size} bytes')
for name, source, px, word in WORDMARK:
font = base.lv_font(convert(source, px, Path(t), name))
keep = {ord(c) for c in word} | {0x20} # the space sets the face's width, which a run needs
code, size = base.emit_font(name, font, keep)
c.append(code)
h.append(f'extern const ht_pfont_t ht_lv_{name};\n')
m = re.search(rf'static const uint16_t {name}_codes\[\] = \{{(.*?)\}};', code)
assert {int(v) for v in m.group(1).split(',')} == keep, name
total += size
print(f'{name}: {word}, line {font["line"]}, ascent {font["line"] - font["base"]}, {size} bytes')
# The curved name's arc face lives with its font: terminal.c names no Focus face, so the compositor's
# tests need not link these (terminal.h declares it).
c.append('// The Focus curved name: Inter Medium 26 on the upper arc. Its stacked Vietnamese capitals stand tall:\n'
'// the curve carries it 5 px nearer the centre than terminal.c\'s ARC_PROP_MID 11 (14 clips the tallest mark\n'
'// at the canvas top, 15 just fits, 16 keeps a pixel), so it ends inside the 128 px arc canvas. A name too long for the arc ends at a word, with no "…" (owner, 2026-10-03).\n'
f'const ht_arc_face_t ht_arc_inter_prop = {{.prop = &ht_lv_inter_med_26, .mid = {INTER_ARC_MID}, .bare = true}};\n'
'// The same face on the lower arc (the working status, the Listening sweep): upright glyphs whose descenders\n'
'// point at the glass, so the default mid-caps offset.\n'
f'const ht_arc_face_t ht_arc_inter_lower = {{.prop = &ht_lv_inter_med_26, .mid = {INTER_ARC_MID_LOWER}}};\n')
(root / 'main/ui/habitat/focus_faces.c').write_text(''.join(c))
(root / 'main/ui/habitat/focus_faces.h').write_text(''.join(h))
print(f'total {total} bytes')
if __name__ == '__main__':
main()