Font files

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search

Written for CEGUI 0.5


Works with versions 0.5.x (obsolete)

Written for CEGUI 0.6


Works with versions 0.6.x (obsolete)

Written for CEGUI 0.7


Works with versions 0.7.x (obsolete)

Written for CEGUI 0.8


Works with versions 0.8.x (stable)

Works with latest CEGUI stable!


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 Scheme files 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
---------------
Version         - specifies the version of the resource file. Should be specified for all files, current CEGUI font version is: 3
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.