Exemple #1
0
void vita2d_free_font(vita2d_font *font)
{
	if (font) {
		FTC_FaceID face_id = (FTC_FaceID)font;
		FTC_Manager_RemoveFaceID(font->ftcmanager, face_id);
		if (font->load_from == VITA2D_LOAD_FROM_FILE) {
			free(font->filename);
		}
		texture_atlas_free(font->tex_atlas);
		free(font);
	}
}
Exemple #2
0
BOOL FreeTypeFontEngine::RemoveFont(LPCWSTR FontName)
{
	if (!FontName) return false;
	LOGFONTW* fontarray = GetFontNameFromFile(FontName);
	LOGFONTW* c_fontarray = fontarray;	//记录原始指针
	if (!fontarray) return false;
	FTC_FaceID fid = NULL;
	BOOL bIsFontLoaded, bIsFontFileLoaded = false;
	COwnedCriticalSectionLock __lock2(2, COwnedCriticalSectionLock::OCS_DC);	//获取所有权,现在要处理DC,禁止所有绘图函数访问
	CCriticalSectionLock __lock(CCriticalSectionLock::CS_MANAGER);
	while (*(char*)fontarray)
	{
		bIsFontLoaded = false;
		FreeTypeFontInfo* result = FindFont(fontarray->lfFaceName, fontarray->lfWeight, !!fontarray->lfItalic, false, &bIsFontLoaded);
		if (result)
		{
			fid = (FTC_FaceID)result->GetId();
			if (bIsFontLoaded)	//该字体已经被使用过
			{
				RemoveFont(result);	//枚举字体信息全部删除
				bIsFontFileLoaded = true;	//设置字体文件也被使用过
			}
			else
				RemoveThisFont(result, fontarray);
			CCriticalSectionLock __lock(CCriticalSectionLock::CS_FONTENG);
			FTC_Manager_RemoveFaceID(cache_man, fid);
			m_mfontList[(int)fid-1]=NULL;
		}
		fontarray++;
	}
	free(c_fontarray); //利用原始指针释放
	if (bIsFontFileLoaded)	//若字体文件被使用过,则需要清楚所有DC
	{
		CTLSDCArray::iterator iter = TLSDCArray.begin();
		while (iter!=TLSDCArray.end())
		{
			((CBitmapCache*)*iter)->~CBitmapCache();	//清除掉所有使用中的DC
			++iter;
		}
	}
	return true;
}
Exemple #3
0
void
_PGFT_UnloadFace(FreeTypeInstance *ft, PgFaceObject *faceobj)
{
    if (faceobj->id.open_args.flags == 0)
        return;

    if (ft) {
        FTC_Manager_RemoveFaceID(ft->cache_manager, (FTC_FaceID)(&faceobj->id));
        quit(faceobj);
    }

    if (faceobj->id.open_args.flags == FT_OPEN_STREAM) {
        _PGFT_free(faceobj->id.open_args.pathname);
    faceobj->id.open_args.pathname = 0;
    }
    else if (faceobj->id.open_args.flags == FT_OPEN_PATHNAME) {
        _PGFT_free(faceobj->id.open_args.stream);
    }
    faceobj->id.open_args.flags = 0;
}
Exemple #4
0
void FreeType::removeFace(FT_Face face)
{
	FTC_Manager_RemoveFaceID(this->cache_, face);
}