FTGL 2.4.0
FTLayout.h
Go to the documentation of this file.
1/*
2 * FTGL - OpenGL font library
3 *
4 * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
5 * Copyright (c) 2008 Sam Hocevar <sam@hocevar.net>
6 * Copyright (c) 2008 Sean Morrison <learner@brlcad.org>
7 *
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:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
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.
26 */
27
28#ifndef __ftgl__
29# warning This header is deprecated. Please use <FTGL/ftgl.h> from now.
30# include <FTGL/ftgl.h>
31#endif
32
33#ifndef __FTLayout__
34#define __FTLayout__
35
36#ifdef __cplusplus
37
38
39class FTLayoutImpl;
40
53{
54 protected:
56
57 private:
64 FTLayout(FTLayoutImpl *pImpl);
65
66 /* Allow our internal subclasses to access the private constructor */
67 friend class FTSimpleLayout;
68
69 public:
73 virtual ~FTLayout();
74
85 virtual FTBBox BBox(const char* string, const int len = -1,
86 FTPoint position = FTPoint()) = 0;
87
98 virtual FTBBox BBox(const wchar_t* string, const int len = -1,
99 FTPoint position = FTPoint()) = 0;
100
111 virtual void Render(const char *string, const int len = -1,
112 FTPoint position = FTPoint(),
113 int renderMode = FTGL::RENDER_ALL) = 0;
114
125 virtual void Render(const wchar_t *string, const int len = -1,
126 FTPoint position = FTPoint(),
127 int renderMode = FTGL::RENDER_ALL) = 0;
128
134 virtual FT_Error Error() const;
135
136 private:
140 FTLayoutImpl *impl;
141};
142
143#endif //__cplusplus
144
146
150struct _FTGLlayout;
151typedef struct _FTGLlayout FTGLlayout;
152
159
168FTGL_EXPORT void ftglGetLayoutBBox(FTGLlayout *layout, const char* string,
169 float bounds[6]);
170
178FTGL_EXPORT void ftglRenderLayout(FTGLlayout *layout, const char *string,
179 int mode);
180
188
190
191#endif /* __FTLayout__ */
192
struct _FTGLlayout FTGLlayout
Definition FTLayout.h:151
void ftglGetLayoutBBox(FTGLlayout *layout, const char *string, float bounds[6])
Get the bounding box for a string.
FT_Error ftglGetLayoutError(FTGLlayout *layout)
Query a layout for errors.
void ftglRenderLayout(FTGLlayout *layout, const char *string, int mode)
Render a string of characters.
void ftglDestroyLayout(FTGLlayout *layout)
Destroy an FTGL layout object.
FTBBox is a convenience class for handling bounding boxes.
Definition FTBBox.h:43
FTLayout is the interface for layout managers that render text.
Definition FTLayout.h:53
virtual FT_Error Error() const
Queries the Layout for errors.
virtual void Render(const char *string, const int len=-1, FTPoint position=FTPoint(), int renderMode=FTGL::RENDER_ALL)=0
Render a string of characters.
virtual void Render(const wchar_t *string, const int len=-1, FTPoint position=FTPoint(), int renderMode=FTGL::RENDER_ALL)=0
Render a string of characters.
virtual FTBBox BBox(const wchar_t *string, const int len=-1, FTPoint position=FTPoint())=0
Get the bounding box for a formatted string.
virtual FTBBox BBox(const char *string, const int len=-1, FTPoint position=FTPoint())=0
Get the bounding box for a formatted string.
virtual ~FTLayout()
Destructor.
FTPoint class is a basic 3-dimensional point or vector.
Definition FTPoint.h:43
FTSimpleLayout is a specialisation of FTLayout for simple text boxes.
#define FTGL_BEGIN_C_DECLS
Definition ftgl.h:43
#define FTGL_END_C_DECLS
Definition ftgl.h:44
#define FTGL_EXPORT
Definition ftgl.h:134
@ RENDER_ALL
Definition ftgl.h:58