Exemple #1
0
void    plWinFontCache::Clear( void )
{
    int     i;


    if( !fInShutdown )
        plStatusLog::AddLineS( "pipeline.log", "** Clearing Win32 font cache **" );

    for( i = 0; i < fFontCache.GetCount(); i++ )
        DeleteObject( fFontCache[ i ].fFont );
    fFontCache.Reset();

    for( i = 0; i < fFontNameCache.GetCount(); i++ )
        delete [] fFontNameCache[ i ];
    fFontNameCache.Reset();

    for( i = 0; i < fCustFonts.GetCount(); i++ )
    {
#if (_WIN32_WINNT >= 0x0500)
        if (plDynSurfaceWriter::CanHandleLotsOfThem())
            RemoveFontResourceExW(fCustFonts[i]->fFilename.AsString().ToWchar(), FR_PRIVATE, 0);
        else
#endif
            if (RemoveFontResourceW(fCustFonts[i]->fFilename.AsString().ToWchar()) == 0)
            {
                int q= 0;
                DWORD e = GetLastError();
            }
        delete fCustFonts[ i ];
    }
    fCustFonts.Reset();
}
Exemple #2
0
bool MCScreenDC::unloadfont(MCStringRef p_path, bool p_globally, void *r_loaded_font_handle)
{
    bool t_success = true;
    DWORD t_private = NULL;
    
    if (p_globally)
        t_private = FR_PRIVATE;
    
    MCAutoStringRefAsWString t_wide_path;
    if (t_success)
        t_success = t_wide_path . Lock(p_path);
    
    if (t_success)
		t_success = (RemoveFontResourceExW(*t_wide_path, t_private, 0) != 0);
    
	if (t_success && p_globally)
		PostMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
    
	return t_success;
}
Exemple #3
0
manager::~manager()
{
#ifdef CAIRO_HAS_FT_FONT
    FcConfigAppFontClear(FcConfigGetCurrent());
#endif

#if CAIRO_HAS_WIN32_FONT
    for(const std::string& path : filesystem::get_binary_paths("fonts")) {
        std::vector<std::string> files;
        if(filesystem::is_directory(path))
            filesystem::get_files_in_dir(path, &files, nullptr, filesystem::ENTIRE_FILE_PATH);
        for(const std::string& file : files) {
            if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
            {
                const std::wstring wfile = unicode_cast<std::wstring>(file);
                RemoveFontResourceExW(wfile.c_str(), FR_PRIVATE, nullptr);
            }
        }
    }
#endif
}
 BOOL WINAPI MyRemoveFontResourceExA( __in LPCSTR name, __in DWORD fl, __reserved PVOID pdv        )
 {
     return RemoveFontResourceExW( FromUTF8( name ), fl, pdv );
 }