VS Code为何渲染空格字符时显示错误字形?
自定义字体在VS Code中空格显示异常问题
我用Font Forge制作了一款自定义字体,该字体在其他所有文本编辑器中均能正常工作,但在VS Code中,空格(U+0020)和不换行空格(U+00A0)会显示错误的字形,而非标准空白空格。(问题示例:显示为Among Us船员形象,而非空白)
已确认其他空白Unicode字符无异常,仅空格和不换行空格在VS Code中存在该问题。
根据建议进行了以下排查:
- 禁用所有扩展后问题仍存在
- 按下空格键后的调试日志如下:
2023-08-02 03:23:11.127 [info] [KeybindingService]: / Soft dispatching keyboard event 2023-08-02 03:23:11.147 [info] [KeybindingService]: | Resolving Space 2023-08-02 03:23:11.148 [info] [KeybindingService]: \ From 6 keybinding entries, no when clauses matched the context. 2023-08-02 03:23:11.148 [info] [KeybindingService]: / Received keydown event - modifiers: [], code: Space, keyCode: 32, key: 2023-08-02 03:23:11.148 [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: Space, keyCode: 10 ('Space') 2023-08-02 03:23:11.149 [info] [KeybindingService]: | Resolving Space 2023-08-02 03:23:11.149 [info] [KeybindingService]: \ From 6 keybinding entries, no when clauses matched the context.
- 修改
render white space选项仅使错误字符从白色变为深灰色(灰色字符示例:深灰色船员形象) - 已将
editor.fontFamily设置为自定义字体名称 - 补充说明:这并非玩笑,我只是将所有未设计图形的字符设为Among Us游戏中的船员形象,空格本应显示为空白,但VS Code中却展示了该默认形象
内容的提问来源于stack exchange,提问作者Kilometer Bob
相关产品推荐
相关产品推荐

