diff --git a/public/fonts/jetbrains-mono-v13-latin-200.woff2 b/public/fonts/jetbrains-mono-v13-latin-200.woff2 new file mode 100644 index 00000000..d23f9b05 Binary files /dev/null and b/public/fonts/jetbrains-mono-v13-latin-200.woff2 differ diff --git a/public/fonts/jetbrains-mono-v13-latin-700.woff2 b/public/fonts/jetbrains-mono-v13-latin-700.woff2 new file mode 100644 index 00000000..5737b146 Binary files /dev/null and b/public/fonts/jetbrains-mono-v13-latin-700.woff2 differ diff --git a/public/fonts/jetbrains-mono-v13-latin-regular.woff2 b/public/fonts/jetbrains-mono-v13-latin-regular.woff2 new file mode 100644 index 00000000..de8b746b Binary files /dev/null and b/public/fonts/jetbrains-mono-v13-latin-regular.woff2 differ diff --git a/src/app/app.less b/src/app/app.less index 6436aac1..29711a42 100644 --- a/src/app/app.less +++ b/src/app/app.less @@ -15,9 +15,9 @@ html, body { overflow: hidden; font-family: @fixed-font; - font-size: 12.5px; + font-size: 12px; font-weight: 300; - line-height: 20px; + line-height: 1.5; background: @base-background-transparent; color: @base-color; } @@ -29,9 +29,9 @@ body.is-dev { textarea { overflow: hidden; font-family: @fixed-font; - font-size: 12.5px; + font-size: 12px; font-weight: 300; - line-height: 20px; + line-height: 1.5; background: @base-background; color: @base-color; } @@ -234,10 +234,15 @@ a.a-block { position: absolute; z-index: -1; top: -5000px; + line-height: normal; .pre { white-space: pre; } + + .mono { + font-family: @terminal-font; + } } .text-button { diff --git a/src/app/line/lines.less b/src/app/line/lines.less index 6f3e8e9c..1787d859 100644 --- a/src/app/line/lines.less +++ b/src/app/line/lines.less @@ -96,6 +96,8 @@ } .terminal-wrapper { + line-height: normal; + &.zero-height { padding: 0; margin: 0; diff --git a/src/index.less b/src/index.less index 86907cf9..14f36174 100644 --- a/src/index.less +++ b/src/index.less @@ -52,3 +52,4 @@ // @font-face declaration lives in app.less @fixed-font: "Martian Mono", sans-serif; +@terminal-font: "JetBrains Mono", sans-serif; diff --git a/src/index.ts b/src/index.ts index 1e7c5f03..7f205343 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,17 +4,27 @@ import { createRoot } from "react-dom/client"; import { sprintf } from "sprintf-js"; import { App } from "./app/app"; import * as DOMPurify from "dompurify"; +import { loadFonts } from "./util/util"; // @ts-ignore let VERSION = __PROMPT_VERSION__; // @ts-ignore let BUILD = __PROMPT_BUILD__; +loadFonts(); + document.addEventListener("DOMContentLoaded", () => { let reactElem = React.createElement(App, null, null); let elem = document.getElementById("app"); let root = createRoot(elem); - root.render(reactElem); + let isFontLoaded = document.fonts.check("12px 'JetBrains Mono'"); + if (isFontLoaded) { + root.render(reactElem); + } else { + document.fonts.ready.then(() => { + root.render(reactElem); + }); + } }); (window as any).mobx = mobx; diff --git a/src/plugins/terminal/term.ts b/src/plugins/terminal/term.ts index b093c167..6bfee5bc 100644 --- a/src/plugins/terminal/term.ts +++ b/src/plugins/terminal/term.ts @@ -89,6 +89,7 @@ class TermWrap { rows: this.termSize.rows, cols: this.termSize.cols, fontSize: opts.fontSize, + fontFamily: "JetBrains Mono", theme: { foreground: terminal.foreground, background: terminal.background }, }); this.terminal._core._inputHandler._parser.setErrorHandler((state) => { diff --git a/src/plugins/terminal/terminal.tsx b/src/plugins/terminal/terminal.tsx index 578afb8a..5bc4c67f 100644 --- a/src/plugins/terminal/terminal.tsx +++ b/src/plugins/terminal/terminal.tsx @@ -150,7 +150,7 @@ class TerminalRenderer extends React.Component< .get(); let cmd = screen.getCmd(line); // will not be null let usedRows = screen.getUsedRows(lineutil.getRendererContext(line), line, cmd, width); - let termHeight = termHeightFromRows(usedRows <= 1 ? usedRows : usedRows + 4, GlobalModel.termFontSize.get()); + let termHeight = termHeightFromRows(usedRows, GlobalModel.termFontSize.get()); let termLoaded = this.termLoaded.get(); return (