Unit CastleOutlineFontData
Description
Outline fonts types.
Outline fonts are composed from lines and curves. They may be represented using types in this unit. We also have CastleFont2Pascal unit that can even convert such fonts to Pascal units, to embed fonts inside Pascal code.
Basic concepts:
Font (TOutlineFontData) is an array of characters.
Character (TOutlineChar) contains a basic character information (size and such) and a sequence of polygons to render this character.
A polygon is a closed sequence of lines. It's defined inside TOutlineCharItem array, with Kind = pkNewPolygon indicating start of a new polygon.
A line is a sequence of points. These points should be rendered as either a sequence of straight line segments, or a Bezier (cubic) curve. Line is defined inside TOutlineCharItem array, with Kind = pkLines or pkBezier indicating start of a new line.
Note: unless you're going to see the font from a really close distance, a simple renderer may be OK with treating Bezier curves just like a sequence of straight line segments.
Since characters may have holes inside, some polygons have to define the outline of the hole. Consider for example an "o" letter, that needs two polygons: one for the outer circle, one for the inner circle. For a given point on a 2D plane, it is part of the letter (e.g. should be drawn with font color) when it's inside an odd number of polygons. If it's inside an even number of polygons (0, or maybe 2, etc.) then it's not part of the letter (should be drawn with background color).
The above definition makes it also natural to draw a font outline using OpenGL GLU tesselator. Simply use GLU_TESS_WINDING_ODD and pass all the polygons.
Overview
Classes, Interfaces, Objects and Records
Types
Description
Types
TPolygonKind = (...); |
Values
-
pkNewPolygon:
-
pkLines:
-
pkBezier:
-
pkPoint:
|
Generated by PasDoc 0.13.0 on 2014-04-30 22:06:43
|