File diff r19115:e871966d9999 → r19116:609e37882a23
src/fontcache.cpp
Show inline comments
 
@@ -953,48 +953,56 @@ void InitFreeType(bool monospace)
 
		}
 
		if (_face_large != NULL) {
 
			SetFontGeometry(_face_large, FS_LARGE, _freetype.large_size);
 
		}
 
	}
 
}
 

	
 
/**
 
 * Free everything allocated w.r.t. fonts.
 
 */
 
void UninitFreeType()
 
{
 
	ResetGlyphCache(true);
 
	ResetGlyphCache(false);
 

	
 
	UnloadFace(&_face_small);
 
	UnloadFace(&_face_medium);
 
	UnloadFace(&_face_large);
 
	UnloadFace(&_face_mono);
 

	
 
	FT_Done_FreeType(_library);
 
	_library = NULL;
 
}
 

	
 
/**
 
 * Reset cached glyphs.
 
 */
 
void ClearFontCache()
 
{
 
	ResetGlyphCache(true);
 
	ResetGlyphCache(false);
 
}
 

	
 
static FT_Face GetFontFace(FontSize size)
 
{
 
	switch (size) {
 
		default: NOT_REACHED();
 
		case FS_NORMAL: return _face_medium;
 
		case FS_SMALL:  return _face_small;
 
		case FS_LARGE:  return _face_large;
 
		case FS_MONO:   return _face_mono;
 
	}
 
}
 

	
 

	
 
struct GlyphEntry {
 
	Sprite *sprite;
 
	byte width;
 
	bool duplicate;
 
};
 

	
 

	
 
/* The glyph cache. This is structured to reduce memory consumption.
 
 * 1) There is a 'segment' table for each font size.
 
 * 2) Each segment table is a discrete block of characters.
 
 * 3) Each block contains 256 (aligned) characters sequential characters.