Portal App Fonts
Introduction
The portal apps in KreaTV can use fonts which are included in
the KreaTV bootimage. Add fonts to the boot image by mentioning them in the boot image config:
kreatv-font-file:/home/fonts/myfont.ttf
Fonts can also be dynamically downloaded over the network with @font-face
Loading Fonts
The browser automatically loads multiple fonts at startup, by doing a
case-insensitive search for *.ttf and *.otf files in the directory
/usr/share/fonts.
This can be memory consuming if too many fonts are included
into the boot image.
The kreatv-font-dejavu-sans IIP installs regular, bold, oblique and bold
oblique font variants in /usr/share/fonts.
It is possible to specify the default font family by adding a
font=<familyname> parameter to the HTML Portal
Application IIP.
Example:
kreatv-app-webkit-portal:font=DejaVu Sans
Selecting Fonts
In order to select which font to use in a page, the following mechanism is
used:
- The font family needs to be selected. This is done e.g. by using the
CSS 2 property 'font-family' or the CSS 3 property '@font-face'. If no
font family is selected the default font will be used. The
default font can be set when the boot image is built, see Loading Fonts
above. If no default font has been set, the last font found in the
directory search will be selected as default font.
- When the font family has been determined, the HTML Portal Application searches within that
font family for the font variant to use. The search is done in the
following order of priority:
- The requested font variant (regular, bold, italic, bold+italic)
- Regular
- Bold
- Italic
- Bold + Italic
You can use tools like fc-scan (available on most Linux distros) to see the font family name in a .ttf file.