Fonts: Difference between revisions

From Alpine Linux
(Add Changing GRUB font and font size)
(reorganized page, added links, added wiki links)
Line 1: Line 1:
'''Fonts''' on Alpine Linux covers a wide range of various languages.  If you can't see your language, you need to install the font that has glyphs (little picture) created for it.  The square box called a substitute character or "tofu" that acts as a placeholder for missing a glyph usually with a two byte sequence.  Tofu is a prepared food that is a traditional part of East Asian and Southeast Asian meals. It is often served in a white rectangular appearance.
'''Fonts''' on Alpine Linux covers a wide range of various languages.  If you can't see your language, you need to install the font that has glyphs (little picture) created for it.  The square box called a substitute character or "tofu" that acts as a placeholder for missing a glyph usually with a two byte sequence.  Tofu is a prepared food that is a traditional part of East Asian and Southeast Asian meals. It is often served in a white rectangular appearance.
<br>


{{Note|The system font directory is located at {{path|/usr/share/fonts}} which is reserved for the Alpine package creators and the package system. The user font location is located in {{path|~/.fonts}} which is the preferred install font location especially from unknown sources.  Fonts have been used as a source of security exploits [https://www.cvedetails.com/vulnerability-list/vendor_id-4535/product_id-7835/Freetype-Freetype.html (See CVEs)] so to reduce the spread of attack install fonts inside {{path|~/.fonts}}.  The trusted system fonts that Alpine Linux packages typically are from well known sources like corporations like Google, Adobe, open organizations like Xorg or well known font designers or projects licensed as either [https://en.wikipedia.org/wiki/SIL_Open_Font_License SIL], GPL, etc.}}
{{Note|The system font directory is located at {{path|/usr/share/fonts}} which is reserved for the Alpine package creators and the package system. The user font location is located in {{path|~/.fonts}} which is the preferred install font location especially from unknown sources.  Fonts have been used as a source of security exploits [https://www.cvedetails.com/vulnerability-list/vendor_id-4535/product_id-7835/Freetype-Freetype.html (See CVEs)] so to reduce the spread of attack install fonts inside {{path|~/.fonts}}.  The trusted system fonts that Alpine Linux packages typically are from well known sources like corporations like Google, Adobe, open organizations like Xorg or well known font designers or projects licensed as either [https://en.wikipedia.org/wiki/SIL_Open_Font_License SIL], GPL, etc.}}
<br>


== Installation ==
== Installation ==
Line 11: Line 7:
Default internal fb fonts (tty console) or xorg fonts (desktops) are suitable for a default installation. {{Pkg|font-misc-misc}} is installed with Xorg, so fonts for most languages (Japanese, Korean, Latin, Cyrillic) are already covered. Exceptions are Arabic, Persian, Thai, Tamil, etc. according to the Wikipedia Page on languages for article translation.  
Default internal fb fonts (tty console) or xorg fonts (desktops) are suitable for a default installation. {{Pkg|font-misc-misc}} is installed with Xorg, so fonts for most languages (Japanese, Korean, Latin, Cyrillic) are already covered. Exceptions are Arabic, Persian, Thai, Tamil, etc. according to the Wikipedia Page on languages for article translation.  


<br>
These selections will cover most languages and are a good fit for most setups: {{cmd|# apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra}}
 
These selections will cover most languages and are a good fit for most setups:  
 
{{cmd|# apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra}}
 
<br>
 
These selections add special support for '''cyrillic languages like Russian and Serbian, etc.''':
 
{{cmd|# apk add font-vollkorn font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic}}
 
<br>
 
These selections cover special '''Asiatic languages like Japanese, etc.''':
 
{{cmd|# apk add font-terminus font-noto font-noto-thai font-noto-tibetan font-ipa font-sony-misc font-jis-misc}}


<br>
These selections add special support for '''cyrillic languages like Russian and Serbian, etc.''': {{cmd|# apk add font-vollkorn font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic}}


The following will add some '''partially supported Chinese fonts''':
These selections cover special '''Asiatic languages like Japanese, etc.''':{{cmd|# apk add font-terminus font-noto font-noto-thai font-noto-tibetan font-ipa font-sony-misc font-jis-misc}}


{{cmd|# apk add font-isas-misc}}
The following will add some '''partially supported Chinese fonts''':{{cmd|# apk add font-isas-misc}}


<br>
These selection will cover, in general '''Arabic, Thai, Ethiopic, Hebrew, Romanian, Persian, Korean Hangul, Greek, Persian, Russian/Slavic Cyrillic, Macedonian/Serbian, Armenian, Georgian, Lao, Devanagari, Urdu (Hindustani as in Northern India and Pakistan), Cherokee, Thaana languages support''' for desktop setups: {{cmd|<nowiki># apk add font-terminus font-noto font-noto-extra font-arabic-misc  
 
These selection will cover, in general '''Arabic, Thai, Ethiopic, Hebrew, Romanian, Persian, Korean Hangul, Greek, Persian, Russian/Slavic Cyrillic, Macedonian/Serbian, Armenian, Georgian, Lao, Devanagari, Urdu (Hindustani as in Northern India and Pakistan), Cherokee, Thaana languages support''' for desktop setups:
 
{{cmd|<nowiki># apk add font-terminus font-noto font-noto-extra font-arabic-misc  
# apk add font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic
# apk add font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic
# apk add font-noto-arabic font-noto-armenian font-noto-cherokee font-noto-devanagari font-noto-ethiopic font-noto-georgian
# apk add font-noto-arabic font-noto-armenian font-noto-cherokee font-noto-devanagari font-noto-ethiopic font-noto-georgian
# apk add font-noto-hebrew font-noto-lao font-noto-malayalam font-noto-tamil font-noto-thaana font-noto-thai
# apk add font-noto-hebrew font-noto-lao font-noto-malayalam font-noto-tamil font-noto-thaana font-noto-thai
</nowiki>}}
</nowiki>}}
<br>


== Configuration ==
== Configuration ==


<code>fc-cache -fv</code> can be used to display the font locations and to update the cache.
=== Changing default font ===
{{Main|Fontconfig}}


<br>
<Code>fc-cache -fv</code> utility from {{pkg|fontconfig}} package can be used to display the font locations and to update the cache.


Some applications do not specify a specific font to use but rather say sans-serif [sans means without as in without tiny lines], serif, monospace [as in proportional square font].  This is where Fontconfig comes into place by substituting the general font type with a specific font that you like.  For package developers, {{path|/etc/fonts/conf.avail}} contains a fontconfig configuration file. This will be symlinked into {{path|/etc/fonts/conf.d}}.  See {{path|/etc/fonts/conf.d/README}} for details about the meaning behind the priority numbers.
Some applications do not specify a specific font to use but rather say sans-serif [sans means without as in without tiny lines], serif, monospace [as in proportional square font].  This is where Fontconfig comes into place by substituting the general font type with a specific font that you like.  For package developers, {{path|/etc/fonts/conf.avail}} contains a fontconfig configuration file. This will be symlinked into {{path|/etc/fonts/conf.d}}.  See {{path|/etc/fonts/conf.d/README}} for details about the meaning behind the priority numbers.


For regular users, you want to create/edit your personal {{path|~/.fonts.conf}}.  This is in XML and describes which preferred font to use for these general types.  See [https://www.freedesktop.org/software/fontconfig/fontconfig-user.html this] for details.
For regular users, you want to create/edit your personal {{path|~/.fonts.conf}}.  This is in XML and describes which preferred font to use for these general types.  See [https://www.freedesktop.org/software/fontconfig/fontconfig-user.html this] for details.


<br>
Per-user Configuration is made in {{path|~/.fonts.conf}} but it's hard to configure. An easier method is to use the {{path|~/.Xresources}} file.
 
Per-user Configuration is made in {{path|~/.fonts.conf}} but it's hard to configure. An easier method is to use the
{{path|~/.Xresources}} file.


The following will set up for all users, a minimal resource usage for fonts. No antialiasing. No hint, etc:
The following will set up for all users, a minimal resource usage for fonts. No antialiasing. No hint, etc:
Line 73: Line 45:
}}
}}


<br>
=== Changing the console font ===


== List of fonts in Alpine Linux ==
The default font may be too small on high-resolution monitors, e.g. 4K ones. To change the default font, e.g. to the 32px ISO Latin-1 Terminus font:
 
# {{cmd|# apk add {{pkg|font-terminus}}}}
# try out fonts in a virtual console using <code># setfont /usr/share/consolefonts/ter-132n.psf.gz</code>
# edit {{path|/etc/conf.d/consolefont}}, set it to the font you choose, e.g. <code>consolefont="ter-132n.psf.gz"</code>
# enable this using <code># rc-update add consolefont boot</code>
 
=== Changing GRUB font and font size ===
 
The font in the GRUB boot screen might also be too small on high-resolution monitors. In order to change the default font and font size in grub, you first need install {{pkg|grub-mkfont}} package:
 
{{cmd|# apk add {{pkg|grub-mkfont}}}}
 
Then you can choose one of the fonts from {{path|/usr/share/fonts}} folder, say {{path|/usr/share/fonts/inconsolata/Inconsolata-Regular.otf}} from the {{pkg|font-inconsolata}} package. Then you can create a grub font with the desired size: {{cmd|# grub-mkfont -s32 /usr/share/fonts/inconsolata/Inconsolata-Regular.otf -o /boot/grub/fonts/inconsolata-32.pf2}}
 
Here we are using size 32 but you can adjust it.
 
After creating the font you need to edit {{path|/etc/default/grub}} and add the configuration with the path for your selected font, e.g. {{path| /boot/grub/fonts/inconsolata-32.pf2}}: {{Cat|/etc/default/grub|<nowiki>...
GRUB_FONT=/boot/grub/fonts/inconsolata-32.pf2
...</nowiki>}}
 
Finally you can run {{cmd|# update-grub}}
 
and then you can reboot your system.
 
== List of available fonts ==
{{seealso|Emojis}}
Here is a list of font packages available in Alpine Linux.


* [https://en.wikipedia.org/wiki/Utopia_(typeface) Utopia] - {{pkg|font-adobe-utopia-*}}
* [https://en.wikipedia.org/wiki/Utopia_(typeface) Utopia] - {{pkg|font-adobe-utopia-*}}
Line 116: Line 115:
* {{pkg|font-arabic-misc}} -- A bitmap and proportional Arabic font in newspaper style [https://unicode.org/mail-arch/unicode-ml/Archives-Old/UML010/0237.html ]
* {{pkg|font-arabic-misc}} -- A bitmap and proportional Arabic font in newspaper style [https://unicode.org/mail-arch/unicode-ml/Archives-Old/UML010/0237.html ]


==Non-free fonts==
=== Non-free fonts ===


* [https://en.wikipedia.org/wiki/Core_fonts_for_the_Web Core fonts for the Web] ({{Pkg|msttcorefonts-installer}}) - For installing non-free proprietary Microsoft fonts like [https://en.wikipedia.org/wiki/Comic_Sans Comic Sans]. Not recommended for commercial or open source projects. See their [https://web.archive.org/web/20091208063245/http://www.microsoft.com/typography/fontpack/eula.htm licensing].
{{Pkg|msttcorefonts-installer}} - Non-free proprietary Microsoft fonts like [https://en.wikipedia.org/wiki/Comic_Sans Comic Sans] part of [https://en.wikipedia.org/wiki/Core_fonts_for_the_Web Core fonts for the Web].  
   Arial
   Arial
   Arial Black
   Arial Black
Line 131: Line 130:
   Webdings
   Webdings


== Changing the console font ==
Not recommended for commercial or open source projects. See their [https://web.archive.org/web/20091208063245/http://www.microsoft.com/typography/fontpack/eula.htm licensing].
 
The default font may be too small on high-resolution monitors, e.g. 4K ones. To change the default font, e.g. to the 32px ISO Latin-1 Terminus font:
 
# {{cmd|# apk add {{pkg|font-terminus}}}}
# try out fonts in a virtual console using <code># setfont /usr/share/consolefonts/ter-132n.psf.gz</code>
# edit {{path|/etc/conf.d/consolefont}}, set it to the font you choose, e.g. <code>consolefont="ter-132n.psf.gz"</code>
# enable this using <code># rc-update add consolefont boot</code>
 
== Changing GRUB font and font size ==
 
The font in the GRUB boot screen might also be too small on high-resolution monitors. In order to change the default font and font size, you first need install ''grub-mkfont'':
 
{{cmd|# apk add {{pkg|grub-mkfont}}}}
 
Then you can choose one of the fonts in {{path|/usr/share/fonts}}, e.g. {{path|/usr/share/fonts/inconsolata/Inconsolata-Regular.otf}}. Then you can create a grub font with the desired size:
 
{{cmd|# grub-mkfont -s32 /usr/share/fonts/inconsolata/Inconsolata-Regular.otf -o /boot/grub/fonts/inconsolata-32.pf2}}
 
Here we are using size 32 but you can adjust it.
 
After creating the font you need to edit {{path|/etc/default/grub}} and add the configuration with the path for your selected font, e.g. {{path| /boot/grub/fonts/inconsolata-32.pf2}}:
 
<code>GRUB_FONT=/boot/grub/fonts/inconsolata-32.pf2</code>
 
Finally you can run
 
{{cmd|# update-grub}}
 
and then you can reboot your system.


== See Also ==
== See also ==


* [[Emojis]]
* [[Emojis]]
* [[Fontconfig]]
* [https://wiki.archlinux.org/title/Fonts Fonts - Archwiki]
* [https://wiki.archlinux.org/title/Fonts Fonts - Archwiki]




[[Category:Infographics]]
[[Category:Infographics]]

Revision as of 06:23, 19 March 2025

Fonts on Alpine Linux covers a wide range of various languages. If you can't see your language, you need to install the font that has glyphs (little picture) created for it. The square box called a substitute character or "tofu" that acts as a placeholder for missing a glyph usually with a two byte sequence. Tofu is a prepared food that is a traditional part of East Asian and Southeast Asian meals. It is often served in a white rectangular appearance.

Note: The system font directory is located at /usr/share/fonts which is reserved for the Alpine package creators and the package system. The user font location is located in ~/.fonts which is the preferred install font location especially from unknown sources. Fonts have been used as a source of security exploits (See CVEs) so to reduce the spread of attack install fonts inside ~/.fonts. The trusted system fonts that Alpine Linux packages typically are from well known sources like corporations like Google, Adobe, open organizations like Xorg or well known font designers or projects licensed as either SIL, GPL, etc.

Installation

Default internal fb fonts (tty console) or xorg fonts (desktops) are suitable for a default installation. font-misc-misc is installed with Xorg, so fonts for most languages (Japanese, Korean, Latin, Cyrillic) are already covered. Exceptions are Arabic, Persian, Thai, Tamil, etc. according to the Wikipedia Page on languages for article translation.

These selections will cover most languages and are a good fit for most setups:

# apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra

These selections add special support for cyrillic languages like Russian and Serbian, etc.:

# apk add font-vollkorn font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic

These selections cover special Asiatic languages like Japanese, etc.:

# apk add font-terminus font-noto font-noto-thai font-noto-tibetan font-ipa font-sony-misc font-jis-misc

The following will add some partially supported Chinese fonts:

# apk add font-isas-misc

These selection will cover, in general Arabic, Thai, Ethiopic, Hebrew, Romanian, Persian, Korean Hangul, Greek, Persian, Russian/Slavic Cyrillic, Macedonian/Serbian, Armenian, Georgian, Lao, Devanagari, Urdu (Hindustani as in Northern India and Pakistan), Cherokee, Thaana languages support for desktop setups:

# apk add font-terminus font-noto font-noto-extra font-arabic-misc # apk add font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic # apk add font-noto-arabic font-noto-armenian font-noto-cherokee font-noto-devanagari font-noto-ethiopic font-noto-georgian # apk add font-noto-hebrew font-noto-lao font-noto-malayalam font-noto-tamil font-noto-thaana font-noto-thai

Configuration

Changing default font

fc-cache -fv utility from fontconfig package can be used to display the font locations and to update the cache.

Some applications do not specify a specific font to use but rather say sans-serif [sans means without as in without tiny lines], serif, monospace [as in proportional square font]. This is where Fontconfig comes into place by substituting the general font type with a specific font that you like. For package developers, /etc/fonts/conf.avail contains a fontconfig configuration file. This will be symlinked into /etc/fonts/conf.d. See /etc/fonts/conf.d/README for details about the meaning behind the priority numbers.

For regular users, you want to create/edit your personal ~/.fonts.conf. This is in XML and describes which preferred font to use for these general types. See this for details.

Per-user Configuration is made in ~/.fonts.conf but it's hard to configure. An easier method is to use the ~/.Xresources file.

The following will set up for all users, a minimal resource usage for fonts. No antialiasing. No hint, etc:

# cat > /home/*/.Xresources << EOF Xft.antialias: 0 Xft.rgba: rgb Xft.autohint: 0 Xft.hinting: 1 Xft.hintstyle: hintslight EOF

Changing the console font

The default font may be too small on high-resolution monitors, e.g. 4K ones. To change the default font, e.g. to the 32px ISO Latin-1 Terminus font:

  1. # apk add font-terminus

  2. try out fonts in a virtual console using # setfont /usr/share/consolefonts/ter-132n.psf.gz
  3. edit /etc/conf.d/consolefont, set it to the font you choose, e.g. consolefont="ter-132n.psf.gz"
  4. enable this using # rc-update add consolefont boot

Changing GRUB font and font size

The font in the GRUB boot screen might also be too small on high-resolution monitors. In order to change the default font and font size in grub, you first need install grub-mkfont package:

# apk add grub-mkfont

Then you can choose one of the fonts from /usr/share/fonts folder, say /usr/share/fonts/inconsolata/Inconsolata-Regular.otf from the font-inconsolata package. Then you can create a grub font with the desired size:

# grub-mkfont -s32 /usr/share/fonts/inconsolata/Inconsolata-Regular.otf -o /boot/grub/fonts/inconsolata-32.pf2

Here we are using size 32 but you can adjust it.

After creating the font you need to edit /etc/default/grub and add the configuration with the path for your selected font, e.g. /boot/grub/fonts/inconsolata-32.pf2:

Contents of /etc/default/grub

... GRUB_FONT=/boot/grub/fonts/inconsolata-32.pf2 ...

Finally you can run

# update-grub

and then you can reboot your system.

List of available fonts

Here is a list of font packages available in Alpine Linux.

Non-free fonts

msttcorefonts-installer - Non-free proprietary Microsoft fonts like Comic Sans part of Core fonts for the Web.

 Arial
 Arial Black
 Andalé Mono
 Courier New
 Comic Sans MS
 Georgia
 Impact
 Times New Roman
 Trebuchet MS
 Verdana
 Webdings

Not recommended for commercial or open source projects. See their licensing.

See also