CrystalSpace

Public API Reference

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

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.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, 5, 0, 1);
00106 
00116 struct iFont : public iBase
00117 {
00124   virtual void AddDeleteCallback (iFontDeleteNotify* func) = 0;
00125 
00129   virtual bool RemoveDeleteCallback (iFontDeleteNotify* func) = 0;
00130   
00135   virtual int GetSize () = 0;
00136 
00141   virtual void GetMaxSize (int &oW, int &oH) = 0;
00142 
00146   virtual bool GetGlyphMetrics (utf32_char c, csGlyphMetrics& metrics) = 0;
00147 
00152   virtual csPtr<iDataBuffer> GetGlyphBitmap (utf32_char c,
00153     csBitmapMetrics& metrics) = 0;
00154 
00160   virtual csPtr<iDataBuffer> GetGlyphAlphaBitmap (utf32_char c,
00161     csBitmapMetrics& metrics) = 0;
00162 
00166   virtual void GetDimensions (const char *text, int &oW, int &oH) = 0;
00167 
00172   virtual void GetDimensions (const char *text, int &oW, int &oH,
00173         int &desc) = 0;
00174 
00179   virtual int GetLength (const char *text, int maxwidth) = 0;
00180   
00187   virtual int GetDescent () = 0; 
00188 
00195   virtual int GetAscent () = 0; 
00196   
00200   virtual bool HasGlyph (utf32_char c) = 0; 
00201 
00206   virtual int GetTextHeight () = 0;
00207 
00215   virtual int GetUnderlinePosition () = 0;
00216 
00222   virtual int GetUnderlineThickness () = 0;
00223 };
00224 
00225 SCF_VERSION (iFontServer, 3, 0, 0);
00226 
00250 struct iFontServer : public iBase
00251 {
00256   virtual csPtr<iFont> LoadFont (const char* filename, 
00257     int size = 10) = 0;
00258 };
00259 
00262 #endif // __CS_IVIDEO_FONTSERV_H__

Generated for Crystal Space by doxygen 1.3.9.1