Qoder 桌面端:支持自定义终端字体 / Support custom terminal font family

版本:Qoder 桌面端 0.4.4(macOS)

Problem

内置终端的字体目前写死为 SFMono-Regular, Menlo, Monaco, Consolas, monospace。设置 → 外观里只有终端主题和界面缩放(终端字号 12px / 13.2px),不能选终端字体。界面里的「字体风格」也只影响界面和任务内容,不影响终端。

很多开发者的 shell 用了 starship、eza、oh-my-posh 这类工具,依赖 Nerd Font 图标。终端不能换成 Nerd Font 时,这些图标会显示成方块或乱码(在中文 macOS 上常变成随机汉字),提示符和文件列表基本没法看。

Solution

  1. 在 设置 → 外观 中增加「终端字体」,支持填写 font-family 列表,例如 'Maple Mono NF', monospace;
  2. 顺带开放终端字号和行高的独立设置,不和界面缩放绑在一起;
  3. 前端已经预留了 CSS 变量 --terminal-font-family,接到设置项上应该就能实现。

Use Case

在 Qoder 内置终端里使用 starship 提示符、eza 带图标的文件列表等依赖 Nerd Font 的工具,图标能正常显示。


The built-in terminal font is hardcoded and can’t be changed in Settings. Please add a “Terminal font family” option (plus independent font size / line height) so Nerd Font users can render shell prompt icons correctly.