Font files

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Revision as of 15:11, 26 February 2011 by Capek (Talk | contribs) (Robot: Cosmetic changes)

Jump to: navigation, search

For the time being, this has been copy-and-pasted directly from "readme.txt" in the XMLRefSchema directory of the CEGUI source code. Some prettier formatting along the lines of this page would be nice.

Font files can define one of two types of font; a static bitmapped font based on an Imageset stored on disc, or a dynamically created font made from a true-type font file (.ttf).

The Root element must be Font.


Font Element
============
Font is the root element, it has some attributes and optional 'Mapping', 'GlyphSet', 'GlyphRange', and 'Glyph' elements.
Mapping elements are only of importance for static / bitmap fonts, any Mapping elements defined for a dynamic font should be ignored.
GlyphSet, GlyphRange, and Glyph elements are only valid for dynamic fonts.

Font attributes
---------------
Name		- the name that will be used to identify the Font within the system. (required).
Filename	- filename for the font.  For Static fonts this is an Imageset.  For Dynamic fonts this is a .ttf file. (required).
ResourceGroup - The resource group identifier to pass to the resource provider when loading the file.
Type		- Specifies the type of font.  Valid options are 'Static' or 'Dynamic' (required).
Size		- Specifies the point size for a dynamic font, ignored for Static fonts.  (optional, default=12).
FirstCodepoint	- Specifies the first codepoint to be available on the dynamic font.  (optional, default=32).
LastCodepoint	- Specifies the last codepoint to be available on the dynamic font.  (optional, default=127).
NativeHorzRes	- The horizontal screen resolution that the images were are intended to be displayed at (optional, default=640).
NativeVertRes	- The vertical screen resolution that the images were are intended to be displayed at (optional, default=480).
AutoScaled	- Boolean, states whether to scale imagery so it appears the same size at any resolution (optional, default=false).
AntiAlias	- Boolean, states whether the font should be anti-aliased, applies to dynamic fonts only.  (optional, default=true).


Mapping Element
===============
Used for static fonts only, defines a mapping between a code-point and a Image on the associated Imageset.
A Mapping must be supplied for every codepoint that the font is to have available.  A Mapping has attributes but no sub-elements.

Mapping attributes
------------------
Codepoint	- Unicode codepoint which should be mapped. (required).
Image		- Name of the image to map.  This image shold be defined for the Imageset specified in Filename for the Font.
HorzAdvance	- Number of pixels to advance the 'pen' position after rendering.  -1 indicates the values should be auto-calculated.  (optional, default=-1).


GlyphSet Element
================
Used for dynamic fonts only.  Defines a set of codepoints for which glyphs should be made available in the font.
Multiple GlyphSet elements may be specified.  A GlyphSet element has attributes but no sub-elements.

GlyphSet attributes
-------------------
Glyphs		- String defining the character / codepoint glyphs to be available.


GlyphRange Element
==================
Used for dynamic fonts only.  Defines a range of codepoints for which glyphs should be made available in the font.
Multiple GlyphRange elements may be specified.  A GlyphRange element has attributes but no sub-elements.

GlyphRange attributes
---------------------
StartCodepoint	- U+ codepoint of the first glyph that is part of this range.
EndCodepoint	- U+ codepoint of the last glyph that is part of this range.


Glyph Element
=============
Used for dynamic fonts only.  Defines a singal codepoint for which a glyph should be made available in the font.
Multiple Glyph elements may be specified.  A Glyph element has attributes but no sub-elements.

Glyph attributes
----------------
Codepoint	- U+ codepoint of the glyph to be added to the font.