更换等宽字体解决中英文不对齐问题 (VSCode, Hyper…)

0. 字体不对齐问题

某些不自觉的软件默认字体会导致在界面里中英文不对齐, 在VSCode的Markdown的编辑中尤为明显:
VSCode Text Before

1. 下载字体 Sarasa Gothic

Github: be5invis/Sarasa-Gothic

Repo最下面有镜像地址, 实测 NJU好像打不开, 用TUNA可以, 下载"sarasa-gothic-ttf-x.xx.x.7z", 或者直接点击这里跳转.

2. 解压后安装

2.1. macOS

  1. 打开"Font Book", 点击"+":

Font Book

  1. 导航至字体文件夹, 根据需要选择"简体中文等宽(sarasa-mono-sc-*.ttf)", 如果想要其他字体那就对应的一起选中:
    Font Book Sarasa Mono SC
  2. 等待安装完成后, 会显示用户安装的字体:
    Font Book User

2.2. Windows

  1. 从设置中打开"字体", 将需要安装的字体选中, 拖拽安装:
    Settings Drag To Install

  2. 等待安裝完成:
    Settings Drag To Installing

3. 编辑 VS Code 设置

  1. 打开 VS Code 设置
    1.1. macOS
    Code – Preferences – Settings
    VS Code Settings macOS

    1.2. Windows
    VS Code Settings Windows

  2. 搜索: "Font Family", 将其中的内容全部替换成"Sarasa Mono SC"
    VS Code Settings Font Family

  3. 关闭设置窗口, 查看修改后的效果:
    VS Code Text After

4. 编辑 Hyper 设置

  1. 与 VS Code 类似, 打开设置

  2. 找到 "fontFamily", 修改成以下内容并保存:

    fontFamily: 'Sarasa Mono SC',

    Hyper Settings Font

  3. 重新打开Hyper, 查看实际效果:
    Hyper Settings Font After

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注