配置语言包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| sudo locale-gen en_US.UTF-8 zh_CN.UTF-8
cat <<'EOF' | sudo tee -a /etc/profile
export LANG=en_US.UTF-8 export LANGUAGE=en_US.UTF-8
EOF
echo 'source /etc/profile' >> ~/.zshrc
sudo mkdir /usr/share/fonts/myfont cd /usr/share/fonts/myfont sudo wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf sudo wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf sudo wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf sudo wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
|
配置字体
添加 Windows 字体,并设置微软雅黑字体优先级
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| sudo apt install fontconfig
cat <<'EOF' | sudo tee /etc/fonts/local.conf <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> <fontconfig> <dir>/mnt/c/Windows/Fonts</dir> <alias> <family>serif</family> <prefer> <family>Microsoft YaHei UI</family><!-- han (zh-cn) --> </prefer> </alias> <alias> <family>sans-serif</family> <prefer> <family>Microsoft YaHei UI</family><!-- han (zh-cn) --> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>Microsoft YaHei UI</family><!-- han (zh-cn) --> </prefer> </alias> <alias> <family>system-ui</family> <prefer> <family>Microsoft YaHei UI</family><!-- han (zh-cn) --> </prefer> </alias>
</fontconfig> EOF
sudo fc-cache -f -v
|
配置 fcitx
1 2 3 4 5 6 7 8 9 10
| sudo apt install fcitx
cat <<'EOF' | sudo tee -a /etc/profile
export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx export DefaultIMModule=fcitx fcitx-autostart &>/dev/null EOF
|
配置搜狗输入法
下载搜狗输入法
1 2 3
| wget -O /tmp/so.deb 搜狗输入法下载地址
sudo apt install /tmp/so.deb
|
下载依赖
1 2 3
| sudo apt install libqt5qml5 libqt5quick5 libqt5quickwidgets5 qml-module-qtquick2
sudo apt install libgsettings-qt1
|
启用输入法
重启 wsl,然后
试用
1 2
| sudo apt install gedit gedit
|
ctrl + space 切换输入法,这里和 Windows 的冲突了,记得关掉 Windows 的,也最好换掉 WSL 的输入法切换,因为这个快捷键和 idea 的自动补全快捷键冲突了
测试微软雅黑是否生效
1 2 3
| wget https://github.com/oldj/SwitchHosts/releases/download/v4.1.2/SwitchHosts_linux_x86_64_4.1.2.6086.AppImage -O /tmp/switch.AppImage sudo chmod +x /tmp/switch.AppImage /tmp/switch.AppImage
|
打开切换中文,打开开发者工具,切换到 computed style
观察使用的字体是否为微软雅黑
参考资料