fontcache.h
00001
00002
00003 #ifndef FONTCACHE_H
00004 #define FONTCACHE_H
00005
00006 #include "gfx_type.h"
00007
00009 SpriteID GetUnicodeGlyph(FontSize size, uint32 key);
00010
00012 void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite);
00013
00015 void InitializeUnicodeGlyphMap();
00016
00017 #ifdef WITH_FREETYPE
00018
00019 struct FreeTypeSettings {
00020 char small_font[260];
00021 char medium_font[260];
00022 char large_font[260];
00023 uint small_size;
00024 uint medium_size;
00025 uint large_size;
00026 bool small_aa;
00027 bool medium_aa;
00028 bool large_aa;
00029 };
00030
00031 extern FreeTypeSettings _freetype;
00032
00033 void InitFreeType();
00034 const struct Sprite *GetGlyph(FontSize size, uint32 key);
00035 uint GetGlyphWidth(FontSize size, uint32 key);
00036
00037 #else
00038
00039
00040 static inline void InitFreeType() {}
00041
00043 static inline const Sprite *GetGlyph(FontSize size, uint32 key)
00044 {
00045 SpriteID sprite = GetUnicodeGlyph(size, key);
00046 if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
00047 return GetSprite(sprite);
00048 }
00049
00050
00052 static inline uint GetGlyphWidth(FontSize size, uint32 key)
00053 {
00054 SpriteID sprite = GetUnicodeGlyph(size, key);
00055 if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
00056 return SpriteExists(sprite) ? GetSprite(sprite)->width + (size != FS_NORMAL) : 0;
00057 }
00058
00059 #endif
00060
00061 #endif