2
* FTGL - OpenGL font library
4
* Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
5
* Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
6
* Copyright (c) 2008 Sean Morrison <learner@brlcad.org>
8
* Permission is hereby granted, free of charge, to any person obtaining
9
* a copy of this software and associated documentation files (the
10
* "Software"), to deal in the Software without restriction, including
11
* without limitation the rights to use, copy, modify, merge, publish,
12
* distribute, sublicense, and/or sell copies of the Software, and to
13
* permit persons to whom the Software is furnished to do so, subject to
14
* the following conditions:
16
* The above copyright notice and this permission notice shall be
17
* included in all copies or substantial portions of the Software.
19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
# warning This header is deprecated. Please use <FTGL/ftgl.h> from now.
30
# include <FTGL/ftgl.h>
33
#ifndef __FTSimpleLayout__
34
#define __FTSimpleLayout__
42
* FTSimpleLayout is a specialisation of FTLayout for simple text boxes.
44
* This class has basic support for text wrapping, left, right and centered
45
* alignment, and text justification.
49
class FTGL_EXPORT FTSimpleLayout : public FTLayout
53
* Initializes line spacing to 1.0, alignment to
54
* ALIGN_LEFT and wrap to 100.0
64
* Get the bounding box for a formatted string.
66
* @param string A char string.
67
* @param len The length of the string. If < 0 then all characters
68
* will be checked until a null character is encountered
70
* @param position The pen position of the first character (optional).
71
* @return The corresponding bounding box.
73
virtual FTBBox BBox(const char* string, const int len = -1,
74
FTPoint position = FTPoint());
77
* Get the bounding box for a formatted string.
79
* @param string A wchar_t string.
80
* @param len The length of the string. If < 0 then all characters
81
* will be checked until a null character is encountered
83
* @param position The pen position of the first character (optional).
84
* @return The corresponding bounding box.
86
virtual FTBBox BBox(const wchar_t* string, const int len = -1,
87
FTPoint position = FTPoint());
90
* Render a string of characters.
92
* @param string 'C' style string to be output.
93
* @param len The length of the string. If < 0 then all characters
94
* will be displayed until a null character is encountered
96
* @param position The pen position of the first character (optional).
97
* @param renderMode Render mode to display (optional)
99
virtual void Render(const char *string, const int len = -1,
100
FTPoint position = FTPoint(),
101
int renderMode = FTGL::RENDER_ALL);
104
* Render a string of characters.
106
* @param string wchar_t string to be output.
107
* @param len The length of the string. If < 0 then all characters
108
* will be displayed until a null character is encountered
110
* @param position The pen position of the first character (optional).
111
* @param renderMode Render mode to display (optional)
113
virtual void Render(const wchar_t *string, const int len = -1,
114
FTPoint position = FTPoint(),
115
int renderMode = FTGL::RENDER_ALL);
118
* Set the font to use for rendering the text.
120
* @param fontInit A pointer to the new font. The font is
121
* referenced by this but will not be
122
* disposed of when this is deleted.
124
void SetFont(FTFont *fontInit);
127
* @return The current font.
132
* The maximum line length for formatting text.
134
* @param LineLength The new line length.
136
void SetLineLength(const float LineLength);
139
* @return The current line length.
141
float GetLineLength() const;
144
* The text alignment mode used to distribute
145
* space within a line or rendered text.
147
* @param Alignment The new alignment mode.
149
void SetAlignment(const FTGL::TextAlignment Alignment);
152
* @return The text alignment mode.
154
FTGL::TextAlignment GetAlignment() const;
157
* Sets the line height.
159
* @param LineSpacing The height of each line of text expressed as
160
* a percentage of the current fonts line height.
162
void SetLineSpacing(const float LineSpacing);
165
* @return The line spacing.
167
float GetLineSpacing() const;
174
FTGL_EXPORT FTGLlayout *ftglCreateSimpleLayout(void);
176
FTGL_EXPORT void ftglSetLayoutFont(FTGLlayout *, FTGLfont*);
177
FTGL_EXPORT FTGLfont *ftglGetLayoutFont(FTGLlayout *);
179
FTGL_EXPORT void ftglSetLayoutLineLength(FTGLlayout *, const float);
180
FTGL_EXPORT float ftglGetLayoutLineLength(FTGLlayout *);
182
FTGL_EXPORT void ftglSetLayoutAlignment(FTGLlayout *, const int);
183
FTGL_EXPORT int ftglGetLayoutAlignement(FTGLlayout *);
185
FTGL_EXPORT void ftglSetLayoutLineSpacing(FTGLlayout *, const float);
186
FTGL_EXPORT float ftglGetLayoutLineSpacing(FTGLlayout *);
190
#endif /* __FTSimpleLayout__ */