Worthless attempt to fix stuff

Originally committed to SVN as r1715.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-14 06:38:33 +00:00
parent 3acc7b35a8
commit 1b6f421917

View file

@ -66,15 +66,23 @@ FreetypeFontFileLister::~FreetypeFontFileLister() {
////////////////////// //////////////////////
// Get name from face // Get name from face
wxString GetName(FT_Face &face,int i) { wxArrayString GetName(FT_Face &face,int id) {
// Get name // Get name
FT_SfntName name; wxArrayString final;
FT_Get_Sfnt_Name(face,i,&name); int count = FT_Get_Sfnt_Name_Count(face);
char *str = new char[name.string_len+1];
memcpy(str,name.string,name.string_len); for (int i=0;i<count;i++) {
str[name.string_len] = 0; FT_SfntName name;
wxString final(str, wxConvLocal); FT_Get_Sfnt_Name(face,i,&name);
delete [] str; if (name.name_id == id) {
char *str = new char[name.string_len+1];
memcpy(str,name.string,name.string_len);
str[name.string_len] = 0;
final.Add(wxString(str, wxConvLocal));
delete [] str;
}
}
return final; return final;
} }
@ -123,14 +131,13 @@ void FreetypeFontFileLister::DoInitialize() {
int nameCount = 0; int nameCount = 0;
wxString ext = fontfiles[i].Right(4).Lower(); wxString ext = fontfiles[i].Right(4).Lower();
if (ext == _T(".otf") || ext == _T(".ttf") || ext == _T(".ttc_")) nameCount = FT_Get_Sfnt_Name_Count(face); if (ext == _T(".otf") || ext == _T(".ttf") || ext == _T(".ttc_")) nameCount = FT_Get_Sfnt_Name_Count(face);
if (nameCount >= 5) { if (nameCount > 0) {
wxString family = GetName(face,1); wxArrayString family = GetName(face,1);
wxString subFamily = GetName(face,2); wxArrayString subFamily = GetName(face,2);
wxString fullName = GetName(face,4); wxArrayString fullName = GetName(face,4);
//AddFont(fontfiles[i],family); //AddFont(fontfiles[i],family);
AddFont(fontfiles[i],family + _T(" ") + subFamily);; for (size_t j=0;j<family.Count() && j<subFamily.Count();j++) AddFont(fontfiles[i],family[j] + _T(" ") + subFamily[j]);
AddFont(fontfiles[i],fullName); for (size_t j=0;j<fullName.Count();j++) AddFont(fontfiles[i],fullName[j]);
AddFont(fontfiles[i],GetName(face,11));
} }
// Add font // Add font