Fix terminal font fallback
This commit is contained in:
@@ -6,6 +6,7 @@ authors = ["Will McGugan <will@textualize.io>"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
packages = [{include = "textual_webterm", from = "src"}]
|
||||
include = [{ path = "src/textual_webterm/static/monospace.css" }]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
|
||||
@@ -590,10 +590,12 @@ class LocalServer:
|
||||
<script src=\"/static/js/textual.js\"></script>
|
||||
<style>
|
||||
body {{ background: #000; margin: 0; padding: 0; }}
|
||||
/* textual-serve relies on injected sizing CSS; make it explicit so layout works even if JS/CSS fail */
|
||||
.textual-terminal {{ width: 100vw; height: 100vh; }}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class=\"textual-terminal\" data-session-websocket-url={ws_url!r} data-font-size=\"16\"></div>
|
||||
<div id=\"terminal\" class=\"textual-terminal\" data-session-websocket-url=\"{ws_url}\" data-font-size=\"16\"></div>
|
||||
</body>
|
||||
</html>"""
|
||||
return web.Response(text=html_content, content_type="text/html")
|
||||
|
||||
@@ -14,6 +14,17 @@ body {
|
||||
font-family: var(--textual-webterm-mono);
|
||||
}
|
||||
|
||||
.xterm {
|
||||
font-family: var(--textual-webterm-mono);
|
||||
/*
|
||||
textual_serve's bundled textual.js hard-codes xterm's Terminal fontFamily:
|
||||
"'Roboto Mono', Monaco, 'Courier New', monospace".
|
||||
|
||||
If Roboto Mono isn't available, it falls back to Courier and looks wrong.
|
||||
We override that here with higher specificity + !important.
|
||||
*/
|
||||
.textual-terminal .xterm,
|
||||
.textual-terminal .xterm .xterm-rows,
|
||||
.textual-terminal .xterm .xterm-helper-textarea,
|
||||
.textual-terminal .xterm .xterm-viewport,
|
||||
.textual-terminal .xterm .xterm-screen {
|
||||
font-family: var(--textual-webterm-mono) !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user