mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-12 08:51:53 +00:00
fix(desktop): bundle JetBrains Mono for the terminal pane (#44642)
The terminal listed JetBrains Mono only as a late fallback and shipped no webfont, so on machines without SF Mono/Menlo xterm measured the grid on the regular system face while styled SGR spans fell back to a font with different advances — glyphs squeezed and overlapped. Bundle the regular/bold/italic woff2 (Apache-2.0, the faces the dashboard already ships), put the family first in the xterm stack, pin the weights, and warm every face before mount (fonts.ready only settles already-requested faces; bold/italic aren't asked for until styled output paints, past atlas init). Vite emits them as hashed assets under dist/** with base './', so the fonts ship in the asar and every install path inherits them.
This commit is contained in:
parent
6db65e687c
commit
6e41ca956b
5 changed files with 34 additions and 7 deletions
|
|
@ -315,8 +315,11 @@ export function useTerminalSession({ cwd, onAddSelectionToChat }: UseTerminalSes
|
|||
allowTransparency: true,
|
||||
convertEol: true,
|
||||
cursorBlink: true,
|
||||
fontFamily: "'SF Mono', 'Menlo', 'Cascadia Code', 'JetBrains Mono', monospace",
|
||||
fontFamily: "'JetBrains Mono', 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace",
|
||||
fontSize: 11,
|
||||
fontWeight: '400',
|
||||
fontWeightBold: '700',
|
||||
letterSpacing: 0,
|
||||
lineHeight: 1.12,
|
||||
// Full-screen TUIs (hermes --tui, vim) grab the mouse, so a plain drag
|
||||
// can't select — ⌥-drag (macOS) / Shift-drag (else) forces a native
|
||||
|
|
@ -598,13 +601,13 @@ export function useTerminalSession({ cwd, onAddSelectionToChat }: UseTerminalSes
|
|||
startSession()
|
||||
}
|
||||
|
||||
const fonts = typeof document !== 'undefined' ? document.fonts : undefined
|
||||
// fonts.ready settles only already-requested faces; bold/italic aren't asked
|
||||
// for until styled output paints (past atlas init), so warm them up front.
|
||||
const warm = document.fonts?.load
|
||||
? Promise.allSettled(['400', '700', 'italic 400'].map(v => document.fonts.load(`${v} 11px 'JetBrains Mono'`)))
|
||||
: Promise.resolve()
|
||||
|
||||
if (fonts?.ready) {
|
||||
void fonts.ready.then(mount, mount)
|
||||
} else {
|
||||
mount()
|
||||
}
|
||||
void warm.then(mount, mount)
|
||||
|
||||
return () => {
|
||||
disposed = true
|
||||
|
|
|
|||
BIN
apps/desktop/src/fonts/JetBrainsMono-Bold.woff2
Normal file
BIN
apps/desktop/src/fonts/JetBrainsMono-Bold.woff2
Normal file
Binary file not shown.
BIN
apps/desktop/src/fonts/JetBrainsMono-Italic.woff2
Normal file
BIN
apps/desktop/src/fonts/JetBrainsMono-Italic.woff2
Normal file
Binary file not shown.
BIN
apps/desktop/src/fonts/JetBrainsMono-Regular.woff2
Normal file
BIN
apps/desktop/src/fonts/JetBrainsMono-Regular.woff2
Normal file
Binary file not shown.
|
|
@ -17,6 +17,30 @@
|
|||
src: url('../../../node_modules/@nous-research/ui/dist/fonts/Collapse-Bold.woff2') format('woff2');
|
||||
}
|
||||
|
||||
/* JetBrains Mono — bundled terminal font (Apache-2.0) so bold/italic share the
|
||||
regular face's metrics instead of squeezing against a system fallback. */
|
||||
@font-face {
|
||||
font-family: 'JetBrains Mono';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('./fonts/JetBrainsMono-Regular.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'JetBrains Mono';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url('./fonts/JetBrainsMono-Bold.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'JetBrains Mono';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('./fonts/JetBrainsMono-Italic.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--dt-background);
|
||||
--color-foreground: var(--dt-foreground);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue