font-awesome - 为什么我的终端外壳上没有呈现或替换 Font Awesome 字符?

标签 font-awesome zsh ubuntu-18.04 oh-my-zsh

我正在尝试自定义我的 Ubuntu 在我的两台电脑上使用 i3-wm , 多边形 zsh (带有 oh-my-zsh 在其上)

我在我的一台计算机上遇到了一些问题,我在另一台上没有,尽管以相同的方式进行并为它们使用相同的配置文件,以便在我的两台设备上拥有相同的工作区。

在 zsh 上,我使用的是 powerlevel10k/powerlevel10k我安装在 oh-my-zsh 上的主题是为了有一个更漂亮的终端。

问题是,当我在 git 项目中时,shell 显示了漂亮的字体图标,例如分支图标,或显示时间旁边的时钟图标等。

这在我的第一台计算机上完美运行,但在第二台计算机上却没有。图标没有显示,所以我的终端不太吸引人。

我对 polybar 有同样的问题。某些图标在一台计算机上可以很好地呈现,而在另一台计算机上却没有呈现。有时,它们甚至会被奇怪的亚洲(我认为它来自亚洲语言,但我不确定)字符所取代。

我想知道为什么我在两台设备上都没有相同的结果以及如何在计算机 2 上修复它。

以下是所用版本的摘要:

Ubuntu = 18.04 LTS
i3-wm = 4.18
Polybar = 3.4.0
zsh = 5.4.2
oh-my-zsh = Version unknown

最佳答案

您需要安装有能力的字体并配置您的终端才能使用。由于您使用的是 powerlevel10k,因此最好使用 the font that powerlevel10k recommends .

Meslo Nerd Font patched for Powerlevel10k

Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple, further customized by André Berg, and finally patched by yours truly with customized scripts originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating systems.

Automatic font installation

If you are using iTerm2 or Termux, p10k configure can install the recommended font for you. Simply answer Yes when asked whether to install Meslo Nerd Font.

If you are using a different terminal, proceed with manual font installation. 👇

Manual font installation

Download these four ttf files:

Double-click on each file and click "Install". This will make MesloLGS NF font available to all applications on your system. Configure your terminal to use this font:

  • iTerm2: Open iTerm2 → Preferences → Profiles → Text and set Font to MesloLGS NF. Alternatively, type p10k configure and answer Yes when asked whether to install Meslo Nerd Font.
  • Apple Terminal Open Terminal → Preferences → Profiles → Text, click Change under Font and select MesloLGS NF family.
  • Hyper: Open Hyper → Edit → Preferences and change the value of fontFamily under module.exports.config to MesloLGS NF.
  • Visual Studio Code: Open File → Preferences → Settings, enter terminal.integrated.fontFamily in the search box and set the value to MesloLGS NF.
  • GNOME Terminal (the default Ubuntu terminal): Open Terminal → Preferences and click on the selected profile under Profiles. Check Custom font under Text Appearance and select MesloLGS NF Regular.
  • Konsole: Open Settings → Edit Current Profile → Appearance, click Select Font and select MesloLGS NF Regular.
  • Tilix: Open Tilix → Preferences and click on the selected profile under Profiles. Check Custom font under Text Appearance and select MesloLGS NF Regular.
  • Windows Console Host (the old thing): Click the icon in the top left corner, then Properties → Font and set Font to MesloLGS NF.
  • Windows Terminal (the new thing): Open Settings (Ctrl+,), search for fontFace and set value to MesloLGS NF for every profile.
  • Termux: Type p10k configure and answer Yes when asked whether to install Meslo Nerd Font.

IMPORTANT: Run p10k configure after changing terminal font. The old ~/.p10k.zsh may work incorrectly with the new font.

关于font-awesome - 为什么我的终端外壳上没有呈现或替换 Font Awesome 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61160791/

相关文章:

input - 在输入占位符文本中使用 Font Awesome (5) 图标

html - 如何从图标高度中心垂直居中对齐文本

html - font awesome css 和 fonts 文件夹正在项目中加载,但 font awesome 图标显示为正方形

shell - 导航到 ZSH 中的目录 (bash)

rvm - zsh中rbenv版本显示右键提示不刷新

shell - 如何组织我的 ZSH 代码?单个文件与多个文件中的多种方法

mysql - Ubuntu 18.04 无root权限启动mysql

meteor - 当用户注销时,内部带有图标的 {{#if currentUser}} 仍然呈现

ubuntu - 想在 ubuntu 18.04 中删除 libboost1.65

javascript - ubunu 中的 Angular CLI 安装错误 - 当我尝试在我的 ubuntu 机器中运行 angular CLI 命令时出现错误