CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

fontserv.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2000 by Norman Krämer
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 "cssys/csunicode.h"
00023 #include "csutil/scf.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 SCF_VERSION (iFontDeleteNotify, 0, 0, 1);
00062 
00073 struct iFontDeleteNotify : public iBase
00074 {
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 
00105 SCF_VERSION (iFont, 4, 0, 0);
00106 
00111 struct iFont : public iBase
00112 {
00119   virtual void AddDeleteCallback (iFontDeleteNotify* func) = 0;
00120 
00124   virtual bool RemoveDeleteCallback (iFontDeleteNotify* func) = 0;
00125   
00132   virtual void SetSize (int iSize) = 0;
00133 
00138   virtual int GetSize () = 0;
00139 
00144   virtual void GetMaxSize (int &oW, int &oH) = 0;
00145 
00149   virtual bool GetGlyphMetrics (utf32_char c, csGlyphMetrics& metrics) = 0;
00150 
00155   virtual csPtr<iDataBuffer> GetGlyphBitmap (utf32_char c,
00156     csBitmapMetrics& metrics) = 0;
00157 
00163   virtual csPtr<iDataBuffer> GetGlyphAlphaBitmap (utf32_char c,
00164     csBitmapMetrics& metrics) = 0;
00165 
00169   virtual void GetDimensions (const char *text, int &oW, int &oH) = 0;
00170 
00175   virtual void GetDimensions (const char *text, int &oW, int &oH,
00176         int &desc) = 0;
00177 
00182   virtual int GetLength (const char *text, int maxwidth) = 0;
00183   
00190   virtual int GetDescent () = 0; 
00191 
00198   virtual int GetAscent () = 0; 
00199   
00203   virtual bool HasGlyph (utf32_char c) = 0; 
00204 };
00205 
00206 SCF_VERSION (iFontServer, 2, 0, 1);
00207 
00216 struct iFontServer : public iBase
00217 {
00222   virtual csPtr<iFont> LoadFont (const char *filename) = 0;
00223 
00227   virtual int GetFontCount () = 0;
00228 
00236   virtual iFont *GetFont (int iIndex) = 0;
00237 };
00238 
00241 #endif // __CS_IVIDEO_FONTSERV_H__

Generated for Crystal Space by doxygen 1.2.14