forked from mia/Aegisub
Fonts collector now seems to work on Linux, and presumably on other posix systems.
Originally committed to SVN as r1462.
This commit is contained in:
parent
0ccf9cb111
commit
1e1f7b411b
1 changed files with 9 additions and 3 deletions
|
@ -49,7 +49,8 @@ wxArrayString FontConfigFontFileLister::DoGetFilesWithFace(wxString facename) {
|
|||
// Code stolen from asa
|
||||
FcPattern *final, *tmp1, *tmp2;
|
||||
FcResult res;
|
||||
FcChar8 *filename;
|
||||
FcChar8 *filename,*gotfamily;
|
||||
int fontindex;
|
||||
char buffer[1024];
|
||||
strcpy(buffer,facename.mb_str(wxConvUTF8));
|
||||
|
||||
|
@ -58,12 +59,17 @@ wxArrayString FontConfigFontFileLister::DoGetFilesWithFace(wxString facename) {
|
|||
if (!tmp1) return results;
|
||||
tmp2 = FcFontRenderPrepare(fontconf, tmp1, aux);
|
||||
FcPatternDestroy(tmp1);
|
||||
FcDefaultSubstitute(tmp2);
|
||||
FcConfigSubstitute(fontconf, tmp2, FcMatchPattern);
|
||||
final = FcFontMatch(fontconf, tmp2, &res);
|
||||
FcPatternDestroy(tmp2);
|
||||
if (!final) return results;
|
||||
if (FcPatternGetString(final, FC_FILE, 0, &filename) == FcResultMatch) {
|
||||
if (FcPatternGetString(final, FC_FILE, 0, &filename) == FcResultMatch && FcPatternGetInteger(final, FC_INDEX, 0, &fontindex) == FcResultMatch) {
|
||||
FcPatternGetString(final, FC_FAMILY, fontindex, &gotfamily);
|
||||
if (strcmp(gotfamily,buffer) == 0) {
|
||||
results.Add(wxString((char*) filename,wxConvLocal));
|
||||
}
|
||||
}
|
||||
FcPatternDestroy(final);
|
||||
|
||||
return results;
|
||||
|
|
Loading…
Reference in a new issue