Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CS_IVIDEO_FONTSERV_H__
00020 #define __CS_IVIDEO_FONTSERV_H__
00021
00022 #include "csutil/csunicode.h"
00023 #include "csutil/scf_interface.h"
00024 #include "csutil/ref.h"
00025
00041
00042 #define CSFONT_LARGE "*large"
00043
00044 #define CSFONT_ITALIC "*italic"
00045
00046 #define CSFONT_COURIER "*courier"
00047
00048 #define CSFONT_SMALL "*small"
00049
00056 #define CS_FONT_DEFAULT_GLYPH 0xffff
00057
00058 struct iFont;
00059 struct iDataBuffer;
00060
00061
00072 struct iFontDeleteNotify : public virtual iBase
00073 {
00074 SCF_INTERFACE(iFontDeleteNotify, 2,0,0);
00076 virtual void BeforeDelete (iFont* font) = 0;
00077 };
00078
00083 struct csBitmapMetrics
00084 {
00086 int width;
00088 int height;
00090 int left;
00092 int top;
00093 };
00094
00099 struct csGlyphMetrics
00100 {
00102 int advance;
00103 };
00104
00112 struct iFont : public virtual iBase
00113 {
00114 SCF_INTERFACE (iFont, 6, 0, 0);
00115
00122 virtual void AddDeleteCallback (iFontDeleteNotify* func) = 0;
00123
00127 virtual bool RemoveDeleteCallback (iFontDeleteNotify* func) = 0;
00128
00133 virtual float GetSize () = 0;
00134
00139 virtual void GetMaxSize (int &oW, int &oH) = 0;
00140
00144 virtual bool GetGlyphMetrics (utf32_char c, csGlyphMetrics& metrics) = 0;
00145
00150 virtual csPtr<iDataBuffer> GetGlyphBitmap (utf32_char c,
00151 csBitmapMetrics& metrics) = 0;
00152
00158 virtual csPtr<iDataBuffer> GetGlyphAlphaBitmap (utf32_char c,
00159 csBitmapMetrics& metrics) = 0;
00160
00164 virtual void GetDimensions (const char *text, int &oW, int &oH) = 0;
00165
00170 virtual void GetDimensions (const char *text, int &oW, int &oH,
00171 int &desc) = 0;
00172
00177 virtual int GetLength (const char *text, int maxwidth) = 0;
00178
00185 virtual int GetDescent () = 0;
00186
00193 virtual int GetAscent () = 0;
00194
00198 virtual bool HasGlyph (utf32_char c) = 0;
00199
00204 virtual int GetTextHeight () = 0;
00205
00213 virtual int GetUnderlinePosition () = 0;
00214
00220 virtual int GetUnderlineThickness () = 0;
00221 };
00222
00242 struct iFontServer : public virtual iBase
00243 {
00244 SCF_INTERFACE (iFontServer, 4, 0, 0);
00245
00250 virtual csPtr<iFont> LoadFont (const char* filename,
00251 float size = 10.0f) = 0;
00252
00258 virtual void SetWarnOnError (bool enable) = 0;
00260 virtual bool GetWarnOnError () = 0;
00261 };
00262
00265 #endif // __CS_IVIDEO_FONTSERV_H__