Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef FONTCACHE_H
00013 #define FONTCACHE_H
00014
00015 #include "spritecache.h"
00016
00018 SpriteID GetUnicodeGlyph(FontSize size, uint32 key);
00019
00021 void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite);
00022
00024 void InitializeUnicodeGlyphMap();
00025
00026 #ifdef WITH_FREETYPE
00027
00028 struct FreeTypeSettings {
00029 char small_font[MAX_PATH];
00030 char medium_font[MAX_PATH];
00031 char large_font[MAX_PATH];
00032 char mono_font[MAX_PATH];
00033 uint small_size;
00034 uint medium_size;
00035 uint large_size;
00036 uint mono_size;
00037 bool small_aa;
00038 bool medium_aa;
00039 bool large_aa;
00040 bool mono_aa;
00041 };
00042
00043 extern FreeTypeSettings _freetype;
00044
00045 void InitFreeType(bool monospace);
00046 void UninitFreeType();
00047 void ClearFontCache();
00048 const Sprite *GetGlyph(FontSize size, uint32 key);
00049 uint GetGlyphWidth(FontSize size, uint32 key);
00050 bool GetDrawGlyphShadow();
00051
00062 bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, class MissingGlyphSearcher *callback);
00063
00064 #else
00065
00066
00067 static inline void InitFreeType(bool monospace) { extern void ResetFontSizes(bool monospace); ResetFontSizes(monospace); }
00068 static inline void UninitFreeType() {}
00069 static inline void ClearFontCache() {}
00070
00072 static inline const Sprite *GetGlyph(FontSize size, uint32 key)
00073 {
00074 SpriteID sprite = GetUnicodeGlyph(size, key);
00075 if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
00076 return GetSprite(sprite, ST_FONT);
00077 }
00078
00079
00081 static inline uint GetGlyphWidth(FontSize size, uint32 key)
00082 {
00083 SpriteID sprite = GetUnicodeGlyph(size, key);
00084 if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
00085 return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + (size != FS_NORMAL) : 0;
00086 }
00087
00088 static inline bool GetDrawGlyphShadow()
00089 {
00090 return false;
00091 }
00092
00093 #endif
00094
00095 #endif