-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
139 lines (93 loc) · 2.6 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
README for PyFTGL
Introduction
============
FTGL is a free, open source library to enable developers to use
arbitrary fonts in their OpenGL applications. Unlike other OpenGL font
libraries FTGL uses standard font file formats and the Freetype font
library to open the fonts.
PyFTGL in turn wraps the functionality of FTGL into a Python module so
that it can be used in conjunction with PyOpenGL.
How to build
============
Prerequisites
-------------
Make sure you have the necessary libraries installed before attempting
to build PyFTGL.
* FTGL
http://homepages.paradise.net.nz/henryj/code/#FTGL
* FreeType
http://www.freetype.org/
* boost::python
http://www.boost.org/
Build
-----
$ python setup.py build
Install
-------
$ python setup.py install
How to use
==========
Overview
--------
To use PyFTGL, start by import it:
>>> import FTGL
PyFTGL supports six different rendering modes:
* Bitmap
* Anti-aliased pixmap
* Anti-aliased texture maps
* Outlines
* Polygon meshes
* Extruded polygon meshes
The first two modes draw directly to the screen raster, the texture
map mode draw textured quads, while the last three draw actual
geometry.
The indivdual modes are encapsulated in their respective class:
* BitmapFont
* PixmapFont
* TextureFont
* OutlineFont
* PolygonFont
* ExtrdFont
However, the protocol for all modes are the same:
>>> font = FTGL.PolygonFont("example.ttf")
>>> font.FaceSize(24)
True
>>> font.line_height
37.51171875
>>> font.Render("foo")
Obviously, you need to set up the OpenGL environment to make it
useful. Please see the example.py script for a demonstration of
PyFTGL.
Classes
-------
class BitmapFont()
class PixmapFont()
class TextureFont()
class OutlineFont()
class PolygonFont()
class ExtrdFont()
Methods defined here:
Advance(string)
Get the advance width for a string.
Attach(font_file_path)
Attach auxilliary file to font e.g font metrics.
Note: not all font formats implement this function.
BBox(string)
Get the bounding box for a string. Returns tuple.
Depth(depth)
Set the extrusion distance for the font. Only implemented
by ExtrdFont.
FaceSize(size[, res])
Set the char size for the current face.
Render(string)
Render a string of characters.
UseDisplayList(useList)
Enable or disable the use of Display Lists inside FTGL.
__init__(font_file_path)
Properties defined here:
ascender
The global ascender height for the face.
descender
The global descender height for the face.
line_height
The line spacing for the font.