static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *lpelfe, const NEWTEXTMETRICEX *metric, DWORD type, LPARAM lParam) { VLC_UNUSED( metric ); if( (type & RASTER_FONTTYPE) ) return 1; // if( lpelfe->elfScript ) FIXME return GetFileFontByName( (LPCTSTR)lpelfe->elfFullName, (char **)lParam ); }
static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *lpelfe, const NEWTEXTMETRICEX *metric, DWORD type, LPARAM lParam) { VLC_UNUSED( metric ); if( (type & RASTER_FONTTYPE) ) return 1; vlc_family_t *p_family = ( vlc_family_t * ) lParam; bool b_bold = ( lpelfe->elfLogFont.lfWeight == FW_BOLD ); bool b_italic = ( lpelfe->elfLogFont.lfItalic != 0 ); /* * This function will be called by Windows as many times for each font * of the family as the number of scripts the font supports. * Check to avoid duplicates. */ for( vlc_font_t *p_font = p_family->p_fonts; p_font; p_font = p_font->p_next ) if( !!p_font->b_bold == !!b_bold && !!p_font->b_italic == !!b_italic ) return 1; char *psz_filename = NULL; char *psz_fontfile = NULL; int i_index = 0; if( GetFileFontByName( (LPCTSTR)lpelfe->elfFullName, &psz_filename, &i_index ) ) return 1; if( strchr( psz_filename, DIR_SEP_CHAR ) ) psz_fontfile = psz_filename; else { /* Get Windows Font folder */ char *psz_win_fonts_path = GetWindowsFontPath(); if( asprintf( &psz_fontfile, "%s\\%s", psz_win_fonts_path, psz_filename ) == -1 ) { free( psz_filename ); free( psz_win_fonts_path ); return 1; } free( psz_filename ); free( psz_win_fonts_path ); } NewFont( psz_fontfile, i_index, b_bold, b_italic, p_family ); return 1; }