ivideo/fontserv.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

ivideo/fontserv.h
Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2000 by Norman Kraemer
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public
    00015     License along with this library; if not, write to the Free
    00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    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__