/** * Free everything allocated w.r.t. fonts. */ void UninitFreeType() { ResetFontSizes(); ResetGlyphCache(); UnloadFace(&_face_small); UnloadFace(&_face_medium); UnloadFace(&_face_large); FT_Done_FreeType(_library); _library = NULL; }
/** * 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; }
/** * (Re)initialize the freetype related things, i.e. load the non-sprite fonts. * @param monospace Whether to initialise the monospace or regular fonts. */ void InitFreeType(bool monospace) { ResetFontSizes(monospace); ResetGlyphCache(monospace); if (monospace) { UnloadFace(&_face_mono); } else { UnloadFace(&_face_small); UnloadFace(&_face_medium); UnloadFace(&_face_large); } if (StrEmpty(_freetype.small_font) && StrEmpty(_freetype.medium_font) && StrEmpty(_freetype.large_font) && StrEmpty(_freetype.mono_font)) { DEBUG(freetype, 1, "No font faces specified, using sprite fonts instead"); return; } if (_library == NULL) { if (FT_Init_FreeType(&_library) != FT_Err_Ok) { ShowInfoF("Unable to initialize FreeType, using sprite fonts instead"); return; } DEBUG(freetype, 2, "Initialized"); } /* Load each font */ if (monospace) { LoadFreeTypeFont(_freetype.mono_font , &_face_mono, "mono"); if (_face_mono != NULL) { SetFontGeometry(_face_mono, FS_MONO, _freetype.mono_size); } } else { LoadFreeTypeFont(_freetype.small_font, &_face_small, "small"); LoadFreeTypeFont(_freetype.medium_font, &_face_medium, "medium"); LoadFreeTypeFont(_freetype.large_font, &_face_large, "large"); /* Set each font size */ if (_face_small != NULL) { SetFontGeometry(_face_small, FS_SMALL, _freetype.small_size); } if (_face_medium != NULL) { SetFontGeometry(_face_medium, FS_NORMAL, _freetype.medium_size); } if (_face_large != NULL) { SetFontGeometry(_face_large, FS_LARGE, _freetype.large_size); } } }