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 const Sprite *GetGlyph(FontSize size, uint32 key);
00048 uint GetGlyphWidth(FontSize size, uint32 key);
00049 bool GetDrawGlyphShadow();
00050
00061 bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, class MissingGlyphSearcher *callback);
00062
00063 #else
00064
00065
00066 static inline void InitFreeType(bool monospace) { extern void ResetFontSizes(bool monospace); ResetFontSizes(monospace); }
00067 static inline void UninitFreeType() {}
00068
00070 static inline const Sprite *GetGlyph(FontSize size, uint32 key)
00071 {
00072 SpriteID sprite = GetUnicodeGlyph(size, key);
00073 if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
00074 return GetSprite(sprite, ST_FONT);
00075 }
00076
00077
00079 static inline uint GetGlyphWidth(FontSize size, uint32 key)
00080 {
00081 SpriteID sprite = GetUnicodeGlyph(size, key);
00082 if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
00083 return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + (size != FS_NORMAL) : 0;
00084 }
00085
00086 static inline bool GetDrawGlyphShadow()
00087 {
00088 return false;
00089 }
00090
00091 #endif
00092
00093 #endif