Files @ r7596:afd285ff90bb
Branch filter:

Location: cpp/openttd-patchpack/source/src/fontcache.h

miham
(svn r11123) -Update: WebTranslator2 update to 2007-09-17 12:45:29
afrikaans - 47 fixed, 52 changed by TrueTenacity (99)
brazilian_portuguese - 23 changed by fukumori (23)
bulgarian - 14 fixed by thetitan (14)
catalan - 3 changed by arnaullv (3)
croatian - 6 fixed, 12 changed by knovak (15), tperic (3)
danish - 20 fixed by ThomasA (20)
finnish - 20 fixed by habazi (20)
german - 10 fixed by Timwi (10)
hungarian - 1 fixed by miham (1)
italian - 1 fixed by lorenzodv (1)
japanese - 6 fixed by ickoonite (6)
norwegian_nynorsk - 6 fixed by pollux (6)
piglatin - 20 fixed by adammw (20)
russian - 20 fixed by Smoky555 (20)
slovak - 1 fixed by lengyel (1)
slovenian - 7 fixed by Necrolyte (7)
spanish - 1 changed by Cabu (1)
traditional_chinese - 21 fixed by xbddc (21)
/* $Id$ */

#ifndef FONTCACHE_H
#define FONTCACHE_H

/** Get the SpriteID mapped to the given font size and key */
SpriteID GetUnicodeGlyph(FontSize size, uint32 key);

/** Map a SpriteID to the font size and key */
void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite);

/** Initialize the glyph map */
void InitializeUnicodeGlyphMap();

#ifdef WITH_FREETYPE

struct FreeTypeSettings {
	char small_font[260];
	char medium_font[260];
	char large_font[260];
	uint small_size;
	uint medium_size;
	uint large_size;
	bool small_aa;
	bool medium_aa;
	bool large_aa;
};

extern FreeTypeSettings _freetype;

void InitFreeType();
const struct Sprite *GetGlyph(FontSize size, uint32 key);
uint GetGlyphWidth(FontSize size, uint32 key);

#else

/* Stub for initializiation */
static inline void InitFreeType() {}

/** Get the Sprite for a glyph */
static inline const Sprite *GetGlyph(FontSize size, uint32 key)
{
	SpriteID sprite = GetUnicodeGlyph(size, key);
	if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
	return GetSprite(sprite);
}


/** Get the width of a glyph */
static inline uint GetGlyphWidth(FontSize size, uint32 key)
{
	SpriteID sprite = GetUnicodeGlyph(size, key);
	if (sprite == 0) sprite = GetUnicodeGlyph(size, '?');
	return SpriteExists(sprite) ? GetSprite(sprite)->width + (size != FS_NORMAL) : 0;
}

#endif /* WITH_FREETYPE */

#endif /* FONTCACHE_H */