Page tree

  Wiki Navigation

    Loading...


 Recently Updated


 Latest Releases

 MediaPortal 1.32
            Releasenews | Download
 MediaPortal 2.5
            Releasenews | Download


Font Aliases in fonts.xml

The skin engine allows for a limited number of font definitions in fonts.xml (~19 fonts). This limitation is established to bound the number of textures created in the run-time environment; each font character is established as a texture at run-time. As the number of textures increases so do the machine requirements to contain the textures in memory. The implementation of aliases in fonts.xml provides flexibility for skinners to name fonts according to their use in the skin implementation; this allows for easy maintenance of the skin; e.g., name the font "menu" rather than "font10" (or similar). Using these flexible font names without aliases introduces the possibility of having to define the same font more than once (with different font names). Doing this not only wastes texture space but also rapidly exhausts the available (limited) pool of available font texture space. Using font aliases the skinner may have a (virtually) unlimited number of alias names against the ~19 font definitions.

Description of change

GUIFontManager holds the entire implementation for aliasing fonts. There is no change to the interface of GUIFontManager and so there is no impact to any other component of MP. When a caller asks GUIFontManager for a GUIFont the GUIFontManager now considers that the name of the requested font to be first an alias. If the alias does not map to a font then a font definition is looked up. Finally, if a font definition is not found then a default font is returned (this is legacy behavior that guarantees a font is available; defined here for completeness).

GUIFontManager maintains a list of alias names that map to font definition names. The alias names are specified inside of fonts.xml using <alias> nodes as follows. In this example myFont simply point at font1. Use of either name results in the rendering of font1.

<fonts>
  <font>
    <name>font1</name>
    ...
  </font>
  <alias>
    <name>myFont</name>
    <fontname>font1</fontname>
  </alias>
</fonts>

   

 

This page has no comments.