Fixed the fonts collector, now it should be able to find any real font installed.
Originally committed to SVN as r1717.
This commit is contained in:
parent
67df761c51
commit
95492cec5e
2 changed files with 23 additions and 8 deletions
|
@ -100,7 +100,11 @@ void FontFileLister::ClearData() {
|
||||||
wxArrayString FontFileLister::CacheGetFilesWithFace(wxString facename) {
|
wxArrayString FontFileLister::CacheGetFilesWithFace(wxString facename) {
|
||||||
FontMap::iterator iter = fontTable.find(facename);
|
FontMap::iterator iter = fontTable.find(facename);
|
||||||
if (iter != fontTable.end()) return iter->second;
|
if (iter != fontTable.end()) return iter->second;
|
||||||
else return wxArrayString();
|
else {
|
||||||
|
iter = fontTable.find(_T("*")+facename);
|
||||||
|
if (iter != fontTable.end()) return iter->second;
|
||||||
|
return wxArrayString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,9 @@ wxArrayString GetName(FT_Face &face,int id) {
|
||||||
str[name.string_len+1] = 0;
|
str[name.string_len+1] = 0;
|
||||||
if (name.encoding_id == 0) final.Add(wxString(str, wxConvLocal));
|
if (name.encoding_id == 0) final.Add(wxString(str, wxConvLocal));
|
||||||
else if (name.encoding_id == 1) {
|
else if (name.encoding_id == 1) {
|
||||||
wxMBConvUTF16LE conv;
|
wxMBConvUTF16BE conv;
|
||||||
final.Add(wxString((wxChar*)str,conv));
|
wxString string(str,conv);
|
||||||
|
final.Add(string);
|
||||||
}
|
}
|
||||||
delete [] str;
|
delete [] str;
|
||||||
}
|
}
|
||||||
|
@ -140,14 +141,24 @@ void FreetypeFontFileLister::DoInitialize() {
|
||||||
wxArrayString family = GetName(face,1);
|
wxArrayString family = GetName(face,1);
|
||||||
wxArrayString subFamily = GetName(face,2);
|
wxArrayString subFamily = GetName(face,2);
|
||||||
wxArrayString fullName = GetName(face,4);
|
wxArrayString fullName = GetName(face,4);
|
||||||
//AddFont(fontfiles[i],family);
|
for (size_t j=0;j<family.Count() && j<subFamily.Count();j++) {
|
||||||
for (size_t j=0;j<family.Count() && j<subFamily.Count();j++) AddFont(fontfiles[i],family[j] + _T(" ") + subFamily[j]);
|
if (subFamily[j] != _T("Regular")) {
|
||||||
|
AddFont(fontfiles[i],family[j] + _T(" ") + subFamily[j]);
|
||||||
|
AddFont(fontfiles[i],_T("*")+family[j]);
|
||||||
|
}
|
||||||
|
else AddFont(fontfiles[i],family[j]);
|
||||||
|
}
|
||||||
for (size_t j=0;j<fullName.Count();j++) AddFont(fontfiles[i],fullName[j]);
|
for (size_t j=0;j<fullName.Count();j++) AddFont(fontfiles[i],fullName[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add font
|
// Ordinary fonts
|
||||||
AddFont(fontfiles[i],wxString(face->family_name, wxConvLocal));
|
else {
|
||||||
if (face->style_name) AddFont(fontfiles[i],wxString(face->family_name, wxConvLocal) + _T(" ") + wxString(face->style_name, wxConvLocal));
|
if (face->style_name) {
|
||||||
|
AddFont(fontfiles[i],wxString(face->family_name, wxConvLocal) + _T(" ") + wxString(face->style_name, wxConvLocal));
|
||||||
|
AddFont(fontfiles[i],_T("*")+wxString(face->family_name, wxConvLocal));
|
||||||
|
}
|
||||||
|
else AddFont(fontfiles[i],wxString(face->family_name, wxConvLocal));
|
||||||
|
}
|
||||||
FT_Done_Face(face);
|
FT_Done_Face(face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue