Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:38:15

0001 /*
0002  * FTGL - OpenGL font library
0003  *
0004  * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
0005  * Copyright (c) 2008 Sam Hocevar <sam@hocevar.net>
0006  * Copyright (c) 2008 Sean Morrison <learner@brlcad.org>
0007  *
0008  * Permission is hereby granted, free of charge, to any person obtaining
0009  * a copy of this software and associated documentation files (the
0010  * "Software"), to deal in the Software without restriction, including
0011  * without limitation the rights to use, copy, modify, merge, publish,
0012  * distribute, sublicense, and/or sell copies of the Software, and to
0013  * permit persons to whom the Software is furnished to do so, subject to
0014  * the following conditions:
0015  *
0016  * The above copyright notice and this permission notice shall be
0017  * included in all copies or substantial portions of the Software.
0018  *
0019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0020  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0021  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0022  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0023  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
0024  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
0025  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0026  */
0027 
0028 #ifndef __ftgl__
0029 #   warning This header is deprecated. Please use <FTGL/ftgl.h> from now.
0030 #   include <FTGL/ftgl.h>
0031 #endif
0032 
0033 #ifndef __FTSimpleLayout__
0034 #define __FTSimpleLayout__
0035 
0036 #ifdef __cplusplus
0037 
0038 
0039 class FTFont;
0040 
0041 /**
0042  * FTSimpleLayout is a specialisation of FTLayout for simple text boxes.
0043  *
0044  * This class has basic support for text wrapping, left, right and centered
0045  * alignment, and text justification.
0046  *
0047  * @see     FTLayout
0048  */
0049 class FTGL_EXPORT FTSimpleLayout : public FTLayout
0050 {
0051     public:
0052         /**
0053          * Initializes line spacing to 1.0, alignment to
0054          * ALIGN_LEFT and wrap to 100.0
0055          */
0056         FTSimpleLayout();
0057 
0058         /**
0059          * Destructor
0060          */
0061         ~FTSimpleLayout();
0062 
0063         /**
0064          * Get the bounding box for a formatted string.
0065          *
0066          * @param string  A char string.
0067          * @param len  The length of the string. If < 0 then all characters
0068          *             will be checked until a null character is encountered
0069          *             (optional).
0070          * @param position  The pen position of the first character (optional).
0071          * @return  The corresponding bounding box.
0072          */
0073         virtual FTBBox BBox(const char* string, const int len = -1,
0074                             FTPoint position = FTPoint());
0075 
0076         /**
0077          * Get the bounding box for a formatted string.
0078          *
0079          * @param string  A wchar_t string.
0080          * @param len  The length of the string. If < 0 then all characters
0081          *             will be checked until a null character is encountered
0082          *             (optional).
0083          * @param position  The pen position of the first character (optional).
0084          * @return  The corresponding bounding box.
0085          */
0086         virtual FTBBox BBox(const wchar_t* string, const int len = -1,
0087                             FTPoint position = FTPoint());
0088 
0089         /**
0090          * Render a string of characters.
0091          *
0092          * @param string    'C' style string to be output.
0093          * @param len  The length of the string. If < 0 then all characters
0094          *             will be displayed until a null character is encountered
0095          *             (optional).
0096          * @param position  The pen position of the first character (optional).
0097          * @param renderMode  Render mode to display (optional)
0098          */
0099         virtual void Render(const char *string, const int len = -1,
0100                             FTPoint position = FTPoint(),
0101                             int renderMode = FTGL::RENDER_ALL);
0102 
0103         /**
0104          * Render a string of characters.
0105          *
0106          * @param string    wchar_t string to be output.
0107          * @param len  The length of the string. If < 0 then all characters
0108          *             will be displayed until a null character is encountered
0109          *             (optional).
0110          * @param position  The pen position of the first character (optional).
0111          * @param renderMode  Render mode to display (optional)
0112          */
0113         virtual void Render(const wchar_t *string, const int len = -1,
0114                             FTPoint position = FTPoint(),
0115                             int renderMode = FTGL::RENDER_ALL);
0116 
0117         /**
0118          * Set the font to use for rendering the text.
0119          *
0120          * @param fontInit A pointer to the new font.  The font is
0121          *                 referenced by this but will not be
0122          *                 disposed of when this is deleted.
0123          */
0124         void SetFont(FTFont *fontInit);
0125 
0126         /**
0127          * @return The current font.
0128          */
0129         FTFont *GetFont();
0130 
0131         /**
0132          * The maximum line length for formatting text.
0133          *
0134          * @param LineLength The new line length.
0135          */
0136         void SetLineLength(const float LineLength);
0137 
0138         /**
0139          * @return The current line length.
0140          */
0141         float GetLineLength() const;
0142 
0143         /**
0144          * The text alignment mode used to distribute
0145          * space within a line or rendered text.
0146          *
0147          * @param Alignment The new alignment mode.
0148          */
0149         void SetAlignment(const FTGL::TextAlignment Alignment);
0150 
0151         /**
0152          * @return The text alignment mode.
0153          */
0154         FTGL::TextAlignment GetAlignment() const;
0155 
0156         /**
0157          * Sets the line height.
0158          *
0159          * @param LineSpacing The height of each line of text expressed as
0160          *                    a percentage of the current fonts line height.
0161          */
0162         void SetLineSpacing(const float LineSpacing);
0163 
0164         /**
0165          * @return The line spacing.
0166          */
0167         float GetLineSpacing() const;
0168 };
0169 
0170 #endif //__cplusplus
0171 
0172 FTGL_BEGIN_C_DECLS
0173 
0174 FTGL_EXPORT FTGLlayout *ftglCreateSimpleLayout(void);
0175 
0176 FTGL_EXPORT void ftglSetLayoutFont(FTGLlayout *, FTGLfont*);
0177 FTGL_EXPORT FTGLfont *ftglGetLayoutFont(FTGLlayout *);
0178 
0179 FTGL_EXPORT void ftglSetLayoutLineLength(FTGLlayout *, const float);
0180 FTGL_EXPORT float ftglGetLayoutLineLength(FTGLlayout *);
0181 
0182 FTGL_EXPORT void ftglSetLayoutAlignment(FTGLlayout *, const int);
0183 FTGL_EXPORT int ftglGetLayoutAlignment(FTGLlayout *);
0184 FTGL_EXPORT int ftglGetLayoutAlignement(FTGLlayout *); // old typo
0185 
0186 FTGL_EXPORT void ftglSetLayoutLineSpacing(FTGLlayout *, const float);
0187 FTGL_EXPORT float ftglGetLayoutLineSpacing(FTGLlayout *);
0188 
0189 FTGL_END_C_DECLS
0190 
0191 #endif  /* __FTSimpleLayout__ */
0192