Merge pull request #11494 from cycoe/master

translated by cycoe
This commit is contained in:
Xingyu.Wang 2018-12-04 22:01:22 +08:00 committed by GitHub
commit bc4a1f60a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 145 additions and 145 deletions

View File

@ -1,145 +0,0 @@
How to Manage Fonts in Linux
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_main.jpg?itok=qcJks7-c)
Not only do I write technical documentation, I write novels. And because Im comfortable with tools like GIMP, I also create my own book covers (and do graphic design for a few clients). That artistic endeavor depends upon a lot of pieces falling into place, including fonts.
Although font rendering has come a long way over the past few years, it continues to be an issue in Linux. If you compare the look of the same fonts on Linux vs. macOS, the difference is stark. This is especially true when youre staring at a screen all day. But even though the rendering of fonts has yet to find perfection in Linux, one thing that the open source platform does well is allow users to easily manage their fonts. From selecting, adding, scaling, and adjusting, you can work with fonts fairly easily in Linux.
Here, Ill share some of the tips Ive depended on over the years to help extend my “font-ability” in Linux. These tips will especially help those who undertake artistic endeavors on the open source platform. Because there are so many desktop interfaces available for Linux (each of which deal with fonts in a different way), when a desktop environment becomes central to the management of fonts, Ill be focusing primarily on GNOME and KDE.
With that said, lets get to work.
### Adding new fonts
For the longest time, I have been a collector of fonts. Some might say I have a bit of an obsession. And since my early days of using Linux, Ive always used the same process for adding fonts to my desktops. There are two ways to do this:
* Make the fonts available on a per-user basis.
* Make the fonts available system-wide.
Because my desktops never have other users (besides myself), I only ever work with fonts on a per-user basis. However, I will show you how to do both. First, lets see how to add fonts on a per-user basis. The first thing you must do is find fonts. Both True Type Fonts (TTF) and Open Type Fonts (OTF) can be added. I add fonts manually. Do this is, I create a new hidden directory in ~/ called ~/.fonts. This can be done with the command:
```
mkdir ~/.fonts
```
With that folder created, I then move all of my TTF and OTF files into the directory. Thats it. Every font you add into that directory will now be available for use to your installed apps. But remember, those fonts will only be available to that one user.
If you want to make that collection of fonts available to all, heres what you do:
1. Open up a terminal window.
2. Change into the directory housing all of your fonts.
3. Copy all of those fonts with the commands sudo cp *.ttf *.TTF /usr/share/fonts/truetype/ and sudo cp *.otf *.OTF /usr/share/fonts/opentype
The next time a user logs in, theyll have access to all those glorious fonts.
### GUI Font Managers
There are a few ways to manage your fonts in Linux, via GUI. How its done will depend on your desktop environment. Lets examine KDE first. With the KDE that ships with Kubuntu 18.04, youll find a Font Management tool pre-installed. Open that tool and you can easily add, remove, enable, and disable fonts (as well as get information about all of the installed fonts. This tool also makes it easy for you to add and remove fonts for personal and system-wide use. Lets say you want to add a particular font for personal usage. To do this, download your font and then open up the Font Management tool. In this tool (Figure 1), click on Personal Fonts and then click the + Add button.
![adding fonts][2]
Figure 1: Adding personal fonts in KDE.
[Used with permission][3]
Navigate to the location of your fonts, select them, and click Open. Your fonts will then be added to the Personal section and are immediately available for you to use (Figure 2).
![KDE Font Manager][5]
Figure 2: Fonts added with the KDE Font Manager.
[Used with permission][3]
To do the same thing in GNOME requires the installation of an application. Open up either GNOME Software or Ubuntu Software (depending upon the distribution youre using) and search for Font Manager. Select Font Manager and then click the Install button. Once the software is installed, launch it from the desktop menu. With the tool open, lets install fonts on a per-user basis. Heres how:
1. Select User from the left pane (Figure 3).
2. Click the + button at the top of the window.
3. Navigate to and select the downloaded fonts.
4. Click Open.
![Adding fonts ][7]
Figure 3: Adding fonts in GNOME.
[Used with permission][3]
### Tweaking fonts
There are three concepts you must first understand:
* **Font Hinting:** The use of mathematical instructions to adjust the display of a font outline so that it lines up with a rasterized grid.
* **Anti-aliasing:** The technique used to add greater realism to a digital image by smoothing jagged edges on curved lines and diagonals.
* **Scaling factor:** **** A scalable unit that allows you to multiple the point size of a font. So if youre font is 12pt and you have an scaling factor of 1, the font size will be 12pt. If your scaling factor is 2, the font size will be 24pt.
Lets say youve installed your fonts, but they dont look quite as good as youd like. How do you tweak the appearance of fonts? In both the KDE and GNOME desktops, you can make a few adjustments. One thing to consider with the tweaking of fonts is that taste is very much subjective. You might find yourself having to continually tweak until you get the fonts looking exactly how you like (dictated by your needs and particular taste). Lets first look at KDE.
Open up the System Settings tool and clock on Fonts. In this section, you can not only change various fonts, you can also enable and configure both anti-aliasing and enable font scaling factor (Figure 4).
![Configuring fonts][9]
Figure 4: Configuring fonts in KDE.
[Used with permission][3]
To configure anti-aliasing, select Enabled from the drop-down and then click Configure. In the resulting window (Figure 5), you can configure an exclude range, sub-pixel rendering type, and hinting style.
Once youve made your changes, click Apply. Restart any running applications and the new settings will take effect.
To do this in GNOME, you have to have either use Font Manager or GNOME Tweaks installed. For this, GNOME Tweaks is the better tool. If you open the GNOME Dash and cannot find Tweaks installed, open GNOME Software (or Ubuntu Software), and install GNOME Tweaks. Once installed, open it and click on the Fonts section. Here you can configure hinting, anti-aliasing, and scaling factor (Figure 6).
![Tweaking fonts][11]
Figure 6: Tweaking fonts in GNOME.
[Used with permission][3]
### Make your fonts beautiful
And thats the gist of making your fonts look as beautiful as possible in Linux. You may not see a macOS-like rendering of fonts, but you can certainly improve the look. Finally, the fonts you choose will have a large impact on how things look. Make sure youre installing clean, well-designed fonts; otherwise, youre fighting a losing battle.
Learn more about Linux through the free ["Introduction to Linux" ][12] course from The Linux Foundation and edX.
--------------------------------------------------------------------------------
via: https://www.linux.com/learn/intro-to-linux/2018/5/how-manage-fonts-linux
作者:[Jack Wallen][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com/users/jlwallen
[2]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_1.jpg?itok=7yTTe6o3 (adding fonts)
[3]:https://www.linux.com/licenses/category/used-permission
[5]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_2.jpg?itok=_g0dyVYq (KDE Font Manager)
[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_3.jpg?itok=8o884QKs (Adding fonts )
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_4.jpg?itok=QJpPzFED (Configuring fonts)
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_6.jpg?itok=4cQeIW9C (Tweaking fonts)
[12]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@ -0,0 +1,145 @@
如何在 Linux 上管理字体
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_main.jpg?itok=qcJks7-c)
我不仅写技术文档,还写小说。并且因为我对 GIMP 等工具感到满意,所以我也(译者注:此处应指使用 GIMP创建了自己的书籍封面并为少数客户做了图形设计。艺术创作取决于很多东西包括字体。
虽然字体渲染已经在过去的几年里取得了长足进步,但它在 Linux 平台上仍是个问题。如果你在 Linux 和 macOS 平台上比较相同字体的外观,差别是显而易见的,尤其是你要盯着屏幕一整天的时候。虽然在 Linux 平台上尚未找到完美的字体渲染方案,开源平台做得好的一件事是允许用户轻松地管理他们的字体。通过选择、添加、缩放和调整,你可以在 Linux 平台上相当轻松地使用字体。
此处,我将分享一些这些年来我赖于在 Linux 上帮助我扩展“字体能力”的技巧。这些技巧将对那些在开源平台上进行艺术创作的人有特别的帮助。因为 Linux 平台上有非常多可用的桌面界面(每种界面以不同的方式处理字体),因此当桌面环境成为字体管理的中心时,我将主要聚焦在 GNOME 和 KDE 上。
话虽如此,让我们开始吧。
### 添加新字体
在相当长的一段时间里,我都是一个字体收藏家,甚至有些人会说我有些痴迷。从我使用 Linux 的早期开始,我就总是用相同的方法向我的桌面添加字体。有两种方法可以做到这一点:
* 使字体针对每个用户可用;
* 使字体在系统范围内可用。
因为我的桌面从没有其他用户除了我自己我只使用了每个用户的字体设置。然而我会向你演示如何完成这两种设置。首先让我们来看一下如何向每个用户添加新字体。你首先要做的是找到字体文件真实类型字体TTF和开源类型字体OTF都可以被添加。我选择手动添加字体也就是说我在 ~/ 目录下新建了一个名为 ~/.fonts 的隐藏目录。该操作可由以下命令完成:
```
mkdir ~/.fonts
```
当此文件夹新建完成,我将所有 TTF 和 OTF 字体文件移动到此文件夹中。也就是说,你在此文件夹中添加的所有字体都可以在已安装的应用中使用了。但是要记住,这些字体只会对这一个用户可用。
如果你想要使这个字体集合对所有用户可用,你可以如下操作:
1. 打开一个终端窗口;
2. 切换路径到包含你所有字体的目录中;
3. 使用 `sudo cp *.ttf *.TTF /usr/share/fonts/truetype/``sudo cp *.otf *.OTF /usr/share/fonts/opentype` 命令拷贝所有字体。
当下次用户登录时,他们就将可以使用所有这些漂亮的字体。
### 图形界面字体管理
在 Linux 上你有许多方式来管理你的字体,如何完成取决于你的桌面环境。让我们以 KDE 为例。使用以 KDE 作为桌面环境的 Kubuntu 18.04,你能够找到一个预装的字体管理工具。打开此工具,你就能轻松地添加、移除、启用或禁用字体(当然也包括获得所有已安装字体的详细信息)。这个工具也能让你轻松地针对每个用户或在系统范围内添加和删除字体。假如你想要为用户添加一个特定的字体,你需要下载该字体并打开字体管理工具。在此工具中(图 1点击个人字体并点击“+”号添加按钮。
![添加字体][2]
图 1: 在 KDE 中添加个人字体。
[经许可使用][3]
导航至你的字体路径,选择它们,然后点击打开。你的字体就会被添加进了个人区域,并且立即可用(图 2
![KDE 字体管理][5]
图 2: 使用 KDE 字体管理添加字体
[经许可使用][3]
在 GNOME 中做同样的事需要安装一个应用。打开 GNOME 软件中心或者 Ubuntu 软件中心(取决于你使用的发行版)并搜索字体管理器。选择 Font Manager 并点击安装按钮。一但安装完成,你就可以从桌面菜单中启动它,然后让我们安装个人字体。下面是如何安装:
1. 从左侧窗格选择“用户”(图 3
2. 点击窗口顶部的 + 按钮;
3. 浏览并选择已下载的字体;
4. 点击“打开”。
![添加字体][7]
图 3: 在 GNOME 中添加字体
[经许可使用][3]
### 调整字体
首先你需要理解 3 条概念:
* **字体提示:** 使用数学指令调整字体轮廓显示,使其与光栅化网格对齐。
* **抗锯齿:** 一种通过使曲线和斜线锯齿状边缘光滑化,提高数字图像真实性的技术。
* **缩放因子:** **** 一个允许你倍增字体大小的缩放单元。也就是说如果你的字体是 12pt 并且缩放因子为 1那么字体大小将会是 12pt。如果你的缩放因子为 2那么字体将会是 24pt。
假设你已经安装好了你的字体,但他们看起来并不像你想的那么好。你将如何调整字体的外观?在 KDE 和 GNOME 中,你都可以做一些调整。在调整字体时需要考虑的一件事是,关于字体的口味是非常主观的。你也许会发现你只得不停地调整,直到你得到了看起来确实满意的字体(由你的需求和特殊口味决定)。让我们先看一下 KDE 下的情况吧。
打开系统设置工具并点击“字体”。在此节中,你不仅能切换不同字体,你也能够启用或配置抗锯齿或启用字体缩放因子(图 4
![配置字体][9]
图 4: 在 KDE 中配置字体
[经许可使用][3]
要配置抗锯齿,在下拉菜单中选择“启用”并点击“配置”。在结果窗口中(图 5你可以配置排除范围、子像素渲染类型和提示类型。
一但你做了更改,点击“应用”。重启所有正在运行的程序,然后新的设置就会生效。
要在 GNOME 中这么做,你需要安装 Font Manager或 GNOME Tweaks。在此处GNOME Tweaks 是更好的工具。如果你打开 GNOME Dash 菜单但没有找到 Tweaks打开 GNOME Software或 Ubuntu Software并安装 GNOME Tweaks。安装完毕打开并点击“字体”此处你可以配置提示、抗锯齿和缩放因子图 6
![调整字体][11]
图 6: 在 GNOME 中调整字体
[经许可使用][3]
### 美化你的字体
以上便是使你的 Linux 字体尽可能漂亮的要旨。你可能得不到像 macOS 那样渲染的字体,但你一定可以提升字体外观。最后,你选择的字体会很大程度地影响视觉效果,因此请确保你安装的字体是干净并且完整适配的,否则你将输掉这次对抗。
通过 The Linux Foundation 和 edX 平台的免费课程 [初识 Linux][12] 了解更多关于 Linux 的信息。
--------------------------------------------------------------------------------
via: https://www.linux.com/learn/intro-to-linux/2018/5/how-manage-fonts-linux
作者:[Jack Wallen][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[cycoe](https://github.com/cycoe)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com/users/jlwallen
[2]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_1.jpg?itok=7yTTe6o3 (adding fonts)
[3]:https://www.linux.com/licenses/category/used-permission
[5]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_2.jpg?itok=_g0dyVYq (KDE Font Manager)
[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_3.jpg?itok=8o884QKs (Adding fonts )
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_4.jpg?itok=QJpPzFED (Configuring fonts)
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_6.jpg?itok=4cQeIW9C (Tweaking fonts)
[12]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux