Ubuntu 20.04 安装 Fira Code 字体

本文涉及的产品
函数计算FC,每月15万CU 3个月
简介: Ubuntu 20.04 安装 Fira Code 字体

采坑提示

习惯了ubuntu 的apt命令,一般安装软件都会通过 $ sudo apt-cache search xxx 来搜索是否存在,如果存在,就安装,这个就遇到坑了!

$ sudo apt-cache search firacode    
fonts-firacode - Monospaced font with programming ligatures
texlive-latex-extra - TeX Live: LaTeX additional packages点击复制复制失败已复制


可以看到,有软件叫 fonts-firacode ,因此我通过 $ sudo apt install fonts-firacode 来安装了这个软件,结果查看字体的时候显示的并不是 ttf 字体,而是 otf 字体!

$ fc-list | grep Fira                          
/usr/share/fonts/opentype/firacode/FiraCode-Retina.otf: Fira Code,Fira Code Retina:style=Retina,Regular
/usr/share/fonts/opentype/firacode/FiraCode-Bold.otf: Fira Code:style=Bold
/usr/share/fonts/opentype/firacode/FiraCode-Regular.otf: Fira Code:style=Regular
/usr/share/fonts/opentype/firacode/FiraCode-Medium.otf: Fira Code,Fira Code Medium:style=Medium,Regular
/usr/share/fonts/opentype/firacode/FiraCode-Light.otf: Fira Code,Fira Code Light:style=Light,Regular点击复制复制失败已复制


因此,这种方式并不可取!!!


2021年10月26日 更新说明

这种方式是可取的!因为通过这种方式安装后 vscode 是支持的!既然如此,推荐用这种方式安装!


脚本安装方式

编写脚本 新建 install.sh 脚本,写入如下内容:

#!/usr/bin/env bash
fonts_dir="${HOME}/.local/share/fonts"
if [ ! -d "${fonts_dir}" ]; then
    echo "mkdir -p $fonts_dir"
    mkdir -p "${fonts_dir}"
else
    echo "Found fonts dir $fonts_dir"
fi
for type in Bold Light Medium Regular Retina; do
    file_path="${HOME}/.local/share/fonts/FiraCode-${type}.ttf"
    file_url="https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-${type}.ttf?raw=true"
    if [ ! -e "${file_path}" ]; then
        echo "wget -O $file_path $file_url"
        wget -O "${file_path}" "${file_url}"
    else
    echo "Found existing file $file_path"
    fi;
done
echo "fc-cache -f"
fc-cache -f点击复制复制失败已复制


运行

$ sh install.sh点击复制复制失败已复制


查看结果

$ fc-list | grep Fira
/home/iric/.local/share/fonts/FiraCode-Light.ttf: Fira Code,Fira Code Light:style=Light,Regular
/home/iric/.local/share/fonts/FiraCode-Bold.ttf: Fira Code:style=Bold
/home/iric/.local/share/fonts/FiraCode-Medium.ttf: Fira Code,Fira Code Medium:style=Medium,Regular
/usr/share/fonts/opentype/firacode/FiraCode-Retina.otf: Fira Code,Fira Code Retina:style=Retina,Regular
/home/iric/.local/share/fonts/FiraCode-Retina.ttf: Fira Code,Fira Code Retina:style=Retina,Regular
/usr/share/fonts/opentype/firacode/FiraCode-Bold.otf: Fira Code:style=Bold
/usr/share/fonts/opentype/firacode/FiraCode-Regular.otf: Fira Code:style=Regular
/usr/share/fonts/opentype/firacode/FiraCode-Medium.otf: Fira Code,Fira Code Medium:style=Medium,Regular
/usr/share/fonts/opentype/firacode/FiraCode-Light.otf: Fira Code,Fira Code Light:style=Light,Regular
/home/iric/.local/share/fonts/FiraCode-Regular.ttf: Fira Code:style=Regular点击复制复制失败已复制

这里面就有 ttf 字体文件了!

相关实践学习
【文生图】一键部署Stable Diffusion基于函数计算
本实验教你如何在函数计算FC上从零开始部署Stable Diffusion来进行AI绘画创作,开启AIGC盲盒。函数计算提供一定的免费额度供用户使用。本实验答疑钉钉群:29290019867
建立 Serverless 思维
本课程包括: Serverless 应用引擎的概念, 为开发者带来的实际价值, 以及让您了解常见的 Serverless 架构模式
目录
相关文章
|
29天前
|
Ubuntu Shell 网络安全
安装了ubuntu虚拟机后发现shell无法连接 ubuntu开启ssh连接
【8月更文挑战第23天】安装了ubuntu虚拟机后发现shell无法连接
85 6
|
18天前
|
Ubuntu Linux Docker
Ubuntu 18.04 安装Docker实战案例
关于如何在Ubuntu 18.04系统上安装Docker的实战案例,包括安装步骤、配置镜像加速以及下载和运行Docker镜像的过程。
105 3
Ubuntu 18.04 安装Docker实战案例
|
18天前
|
Ubuntu 网络安全 开发工具
Ubuntu19.04的安装过程详解以及操作系统初始化配置
本文详细介绍了Ubuntu 19.04操作系统的安装过程、初始化配置、网络设置、软件源配置、SSH远程登录以及终端显示设置。
43 1
Ubuntu19.04的安装过程详解以及操作系统初始化配置
|
5天前
|
存储 Prometheus 监控
在Ubuntu系统上安装与配置Prometheus的步骤
通过以上步骤,您应该已经成功在Ubuntu系统上安装并配置了Prometheus。您现在可以开始使用Prometheus收集和分析您的系统和应用程序的指标数据了。
16 1
|
18天前
|
Ubuntu NoSQL
ubuntu上安装某个程序的符号表和源码包
ubuntu上安装某个程序的符号表和源码包
|
18天前
|
Ubuntu
在树莓派4B上安装ubuntu系统
在树莓派4B上安装ubuntu系统
|
18天前
|
Ubuntu
使用dpkg在ubuntu上安装软件包遇到依赖包的问题
使用dpkg在ubuntu上安装软件包遇到依赖包的问题
|
23天前
|
Ubuntu Shell C++
在Ubuntu18.04上安装ros2的环境,ros2的常用命令:播放包、录制包等
在Ubuntu18.04上安装ros2的环境,ros2的常用命令:播放包、录制包等
35 1
|
23天前
|
Ubuntu Docker 索引
2024年最新版 Ubuntu 20+ 上安装 Docker
这篇文章提供了在Ubuntu 20+版本上安装Docker的详细步骤,包括更新软件包索引、安装依赖包、添加Docker官方GPG密钥、设置Docker稳定版仓库、安装Docker CE以及验证安装是否成功,并指导如何将用户添加到docker组以非root用户身份运行Docker。
|
29天前
|
Ubuntu Linux 开发工具
【事件中心 Azure Event Hub】在Linux环境中(Ubuntu)安装Logstash的简易步骤及配置连接到Event Hub
【事件中心 Azure Event Hub】在Linux环境中(Ubuntu)安装Logstash的简易步骤及配置连接到Event Hub