Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:15:00

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 __FTLayout__
0034 #define __FTLayout__
0035 
0036 #ifdef __cplusplus
0037 
0038 
0039 class FTLayoutImpl;
0040 
0041 /**
0042  * FTLayout is the interface for layout managers that render text.
0043  *
0044  * Specific layout manager classes are derived from this class. This class
0045  * is abstract and deriving classes must implement the protected
0046  * <code>Render</code> methods to render formatted text and
0047  * <code>BBox</code> methods to determine the bounding box of output text.
0048  *
0049  * @see     FTFont
0050  * @see     FTBBox
0051  */
0052 class FTGL_EXPORT FTLayout
0053 {
0054     protected:
0055         FTLayout();
0056 
0057     private:
0058         /**
0059          * Internal FTGL FTLayout constructor. For private use only.
0060          *
0061          * @param pImpl  Internal implementation object. Will be destroyed
0062          *               upon FTLayout deletion.
0063          */
0064         FTLayout(FTLayoutImpl *pImpl);
0065 
0066         /* Allow our internal subclasses to access the private constructor */
0067         friend class FTSimpleLayout;
0068 
0069     public:
0070         /**
0071          * Destructor
0072          */
0073         virtual ~FTLayout();
0074 
0075         /**
0076          * Get the bounding box for a formatted string.
0077          *
0078          * @param string  A char string.
0079          * @param len  The length of the string. If < 0 then all characters
0080          *             will be checked until a null character is encountered
0081          *             (optional).
0082          * @param position  The pen position of the first character (optional).
0083          * @return  The corresponding bounding box.
0084          */
0085         virtual FTBBox BBox(const char* string, const int len = -1,
0086                             FTPoint position = FTPoint()) = 0;
0087 
0088         /**
0089          * Get the bounding box for a formatted string.
0090          *
0091          * @param string  A wchar_t string.
0092          * @param len  The length of the string. If < 0 then all characters
0093          *             will be checked until a null character is encountered
0094          *             (optional).
0095          * @param position  The pen position of the first character (optional).
0096          * @return  The corresponding bounding box.
0097          */
0098         virtual FTBBox BBox(const wchar_t* string, const int len = -1,
0099                             FTPoint position = FTPoint()) = 0;
0100 
0101         /**
0102          * Render a string of characters.
0103          *
0104          * @param string    'C' style string to be output.
0105          * @param len  The length of the string. If < 0 then all characters
0106          *             will be displayed until a null character is encountered
0107          *             (optional).
0108          * @param position  The pen position of the first character (optional).
0109          * @param renderMode  Render mode to display (optional)
0110          */
0111         virtual void Render(const char *string, const int len = -1,
0112                             FTPoint position = FTPoint(),
0113                             int renderMode = FTGL::RENDER_ALL) = 0;
0114 
0115         /**
0116          * Render a string of characters.
0117          *
0118          * @param string    wchar_t string to be output.
0119          * @param len  The length of the string. If < 0 then all characters
0120          *             will be displayed until a null character is encountered
0121          *             (optional).
0122          * @param position  The pen position of the first character (optional).
0123          * @param renderMode  Render mode to display (optional)
0124          */
0125         virtual void Render(const wchar_t *string, const int len = -1,
0126                             FTPoint position = FTPoint(),
0127                             int renderMode = FTGL::RENDER_ALL) = 0;
0128 
0129         /**
0130          * Queries the Layout for errors.
0131          *
0132          * @return  The current error code.
0133          */
0134         virtual FT_Error Error() const;
0135 
0136     private:
0137         /**
0138          * Internal FTGL FTLayout implementation object. For private use only.
0139          */
0140         FTLayoutImpl *impl;
0141 };
0142 
0143 #endif //__cplusplus
0144 
0145 FTGL_BEGIN_C_DECLS
0146 
0147 /**
0148  * FTGLlayout is the interface for layout managers that render text.
0149  */
0150 struct _FTGLlayout;
0151 typedef struct _FTGLlayout FTGLlayout;
0152 
0153 /**
0154  * Destroy an FTGL layout object.
0155  *
0156  * @param layout  An FTGLlayout* object.
0157  */
0158 FTGL_EXPORT void ftglDestroyLayout(FTGLlayout* layout);
0159 
0160 /**
0161  * Get the bounding box for a string.
0162  *
0163  * @param layout  An FTGLlayout* object.
0164  * @param string  A char buffer
0165  * @param bounds  An array of 6 float values where the bounding box's lower
0166  *                left near and upper right far 3D coordinates will be stored.
0167  */
0168 FTGL_EXPORT void ftglGetLayoutBBox(FTGLlayout *layout, const char* string,
0169                                    float bounds[6]);
0170 
0171 /**
0172  * Render a string of characters.
0173  *
0174  * @param layout  An FTGLlayout* object.
0175  * @param string  Char string to be output.
0176  * @param mode  Render mode to display.
0177  */
0178 FTGL_EXPORT void ftglRenderLayout(FTGLlayout *layout, const char *string,
0179                                   int mode);
0180 
0181 /**
0182  * Query a layout for errors.
0183  *
0184  * @param layout  An FTGLlayout* object.
0185  * @return  The current error code.
0186  */
0187 FTGL_EXPORT FT_Error ftglGetLayoutError(FTGLlayout* layout);
0188 
0189 FTGL_END_C_DECLS
0190 
0191 #endif  /* __FTLayout__ */
0192