Fonts: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Ronie
(16 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{mininav|[[Development]]|[[Skinning]]}}
<section begin="main content" />
There's one special file called font.xml. This file contains a list of all fonts the skin uses. XBMC
There's one special file called font.xml. This file contains a list of all fonts the skin uses. XBMC
will load all the fonts mentioned in this file from the /myskin/fonts directory first, and if that fails,
will load all the fonts mentioned in this file from the /myskin/fonts directory first, and if that fails,
will attempt to load them from XBMC/media/fonts. In the event that XBMC is unable to locate the specified font, it will default to "font13". You can modify this file as you like and
will attempt to load them from XBMC/media/fonts. In the event that Kodi is unable to locate the specified font, it will default to "font13". You can modify this file as you like and
add/delete/change fonts. The user friendly font name is referenced by the other xml files mentioned
add/delete/change fonts. The user friendly font name is referenced by the other xml files mentioned
below.
below.
Line 8: Line 10:
The font.xml file is divided into font sets, which includes a set of fonts used by the skin. Every
The font.xml file is divided into font sets, which includes a set of fonts used by the skin. Every
font set must contain the same font names in order for the skin to work with all font sets.
font set must contain the same font names in order for the skin to work with all font sets.
<source lang="xml">
<syntaxhighlight lang="xml" enclose="div">
   <fontset id="Default" idloc="31390" unicode="false">
  <?xml version="1.0" encoding="UTF-8"?>
   <fonts>
    <fontset id="Default" idloc="31390">
       <font>
       <font>
       ....
       ....
Line 17: Line 21:
       </font>
       </font>
       ....
       ....
  </fontset>
    </fontset>
  <fontset id="Arial" idloc="31391" unicode="true">
    <fontset id="Arial" idloc="31391">
       <font>
       <font>
       ....
       ....
       </font>
       </font>
       ....
       ....
   </fontset>
    </fontset>
</source>
   </fonts>
</syntaxhighlight>
A font set has the following attributes:
A font set has the following attributes:


Line 31: Line 36:
; idloc
; idloc
: Refers to a string in the Skins' language file, so font names can be localized.
: Refers to a string in the Skins' language file, so font names can be localized.
; unicode
: Whether or not a font set supports unicode characters. Supported values are “true” or “false”


There has to be at least one font set with the unicode attribute set to true else languages like Chinese or Korean will not display properly. There is a font called Arialuni.TTF with a size of 20MB. It is a unicode True Type Font and works with all languages xbmc supports.
There has to be at least one font set with the unicode attribute set to true else languages like Chinese or Korean will not display properly. There is a font called Arialuni.TTF with a size of 20MB. It is a unicode True Type Font and works with all languages Kodi supports.




'''Note:''' XBMC will automatically switch to the first available unicode font set if the user selects a language that needs one. This switch will not be made if the currently loaded font set already supports unicode.
'''Note:''' Kodi will automatically switch to the first available unicode font set if the user selects a language that needs one. This switch will not be made if the currently loaded font set already supports unicode.


== Supported Font Types ==
== Supported Font Types ==
=== True type Fonts ===
=== True type Fonts ===
True type fonts must have a .ttf suffix. For a true type font it is possible to define the size (default 20)
True type fonts must have a .ttf suffix. For a true type font it is possible to define the size (default 20)
and a style ''normal'', ''bold'', ''italics'', or ''bolditalics''. Frodo also includes ''lowercase'' or ''uppercase''.
and a style ''normal'', ''bold'', ''italics'', or ''bolditalics''. Frodo also includes ''lowercase'' or ''uppercase''. Isengard includes ''capitalize''. Jarvis includes ''lighten''.


Note: Multiple styles can be used by separating them with a space.
Note: Multiple styles can be used by separating them with a space.


Example:
Example:
<source lang="xml">
<syntaxhighlight lang="xml" enclose="div">
   <font>
   <font>
     <name>font12</name>
     <name>font12</name>
     <filename>arial.ttf</name>
     <filename>arial.ttf</name>
     <size>12</size>
     <size>12</size>
     <style>uppercase lowercase bold</style>
     <style>uppercase lowercase capitalize bold lighten</style>
     <aspect>0.75</aspect>
     <aspect>0.75</aspect>
     <linespacing>1.0</linespacing>
     <linespacing>1.0</linespacing>
   </font>
   </font>
</source>
</syntaxhighlight>


The <aspect> tag specifies the aspect ratio of the font. An aspect of 0.75 means that the width of the font will be 0.75 of the height. By default the aspect is 1.0 for all but the SD 16x9 modes (PAL16x9, NTSC16x9 and 480p16x9) where the aspect ratio is 0.75, due to the stretched pixels.
The <aspect> tag specifies the aspect ratio of the font. An aspect of 0.75 means that the width of the font will be 0.75 of the height. By default the aspect is 1.0 for all but the SD 16x9 modes (PAL16x9, NTSC16x9 and 480p16x9) where the aspect ratio is 0.75, due to the stretched pixels.


The <linespacing> tag defines height of each line (sometimes called leading or inteline spacing). By default linespacing is set to 1.0.
The <linespacing> tag defines height of each line (sometimes called leading or inteline spacing). By default linespacing is set to 1.0.
<section end="main content" />


[[Category:Development]]
[[Category:Development]]
[[Category:Skin Development]]
[[Category:Skin development]]
[[Category:Languages]]
[[Category:Languages]]

Revision as of 22:07, 12 November 2015

Home icon grey.png   ▶ Development ▶ Skinning ▶ Fonts

There's one special file called font.xml. This file contains a list of all fonts the skin uses. XBMC will load all the fonts mentioned in this file from the /myskin/fonts directory first, and if that fails, will attempt to load them from XBMC/media/fonts. In the event that Kodi is unable to locate the specified font, it will default to "font13". You can modify this file as you like and add/delete/change fonts. The user friendly font name is referenced by the other xml files mentioned below.

Format of the Font.xml File

The font.xml file is divided into font sets, which includes a set of fonts used by the skin. Every font set must contain the same font names in order for the skin to work with all font sets.

  <?xml version="1.0" encoding="UTF-8"?>
  <fonts>
    <fontset id="Default" idloc="31390">
      <font>
       ....
      </font>
      <font>
      ....
      </font>
      ....
    </fontset>
    <fontset id="Arial" idloc="31391">
      <font>
      ....
      </font>
      ....
    </fontset>
  </fonts>

A font set has the following attributes:

id
Name of the font set. Displayed to the user. Can have any value.
idloc
Refers to a string in the Skins' language file, so font names can be localized.

There has to be at least one font set with the unicode attribute set to true else languages like Chinese or Korean will not display properly. There is a font called Arialuni.TTF with a size of 20MB. It is a unicode True Type Font and works with all languages Kodi supports.


Note: Kodi will automatically switch to the first available unicode font set if the user selects a language that needs one. This switch will not be made if the currently loaded font set already supports unicode.

Supported Font Types

True type Fonts

True type fonts must have a .ttf suffix. For a true type font it is possible to define the size (default 20) and a style normal, bold, italics, or bolditalics. Frodo also includes lowercase or uppercase. Isengard includes capitalize. Jarvis includes lighten.

Note: Multiple styles can be used by separating them with a space.

Example:

  <font>
     <name>font12</name>
     <filename>arial.ttf</name>
     <size>12</size>
     <style>uppercase lowercase capitalize bold lighten</style>
     <aspect>0.75</aspect>
     <linespacing>1.0</linespacing>
  </font>

The <aspect> tag specifies the aspect ratio of the font. An aspect of 0.75 means that the width of the font will be 0.75 of the height. By default the aspect is 1.0 for all but the SD 16x9 modes (PAL16x9, NTSC16x9 and 480p16x9) where the aspect ratio is 0.75, due to the stretched pixels.

The <linespacing> tag defines height of each line (sometimes called leading or inteline spacing). By default linespacing is set to 1.0.