mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-09 14:40:10 +01:00
52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
|
|
#include "detection/qt.h"
|
||
|
|
#include "detection/gtk.h"
|
||
|
|
#include "common/parsing.h"
|
||
|
|
#include "common/font.h"
|
||
|
|
#include "font.h"
|
||
|
|
|
||
|
|
const char* ffDetectFontImpl(FFinstance* instance, FFlist* result)
|
||
|
|
{
|
||
|
|
const FFstrbuf* qtRaw = &ffDetectQt(instance)->font;
|
||
|
|
const FFstrbuf* gtk2Raw = &ffDetectGTK2(instance)->font;
|
||
|
|
const FFstrbuf* gtk3Raw = &ffDetectGTK3(instance)->font;
|
||
|
|
const FFstrbuf* gtk4Raw = &ffDetectGTK4(instance)->font;
|
||
|
|
|
||
|
|
if(qtRaw->length > 0)
|
||
|
|
{
|
||
|
|
FFfont qt;
|
||
|
|
ffFontInitQt(&qt, qtRaw->chars);
|
||
|
|
|
||
|
|
FFFontResult* resultQt = (FFFontResult *)ffListAdd(result);
|
||
|
|
resultQt->type = "QT";
|
||
|
|
ffStrbufInitCopy(&resultQt->fontPretty, &qt.pretty);
|
||
|
|
|
||
|
|
ffFontDestroy(&qt);
|
||
|
|
}
|
||
|
|
|
||
|
|
if(gtk2Raw->length > 0 || gtk3Raw->length > 0 || gtk4Raw->length > 0)
|
||
|
|
{
|
||
|
|
FFfont gtk2;
|
||
|
|
ffFontInitPango(>k2, gtk2Raw->chars);
|
||
|
|
|
||
|
|
FFfont gtk3;
|
||
|
|
ffFontInitPango(>k3, gtk3Raw->chars);
|
||
|
|
|
||
|
|
FFfont gtk4;
|
||
|
|
ffFontInitPango(>k4, gtk4Raw->chars);
|
||
|
|
|
||
|
|
FFFontResult* resultGtk = (FFFontResult *)ffListAdd(result);
|
||
|
|
resultGtk->type = "GTK";
|
||
|
|
ffStrbufInit(&resultGtk->fontPretty);
|
||
|
|
ffParseGTK(&resultGtk->fontPretty, >k2.pretty, >k3.pretty, >k4.pretty);
|
||
|
|
|
||
|
|
ffFontDestroy(>k2);
|
||
|
|
ffFontDestroy(>k3);
|
||
|
|
ffFontDestroy(>k4);
|
||
|
|
}
|
||
|
|
|
||
|
|
if(result->length == 0)
|
||
|
|
return "No fonts found";
|
||
|
|
|
||
|
|
return NULL;
|
||
|
|
}
|