mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:52:08 +02:00
7aad0dc32f
Signed-off-by: Diego Viola <diego.viola@gmail.com>
58 lines
1.6 KiB
C
58 lines
1.6 KiB
C
#include "common/font.h"
|
|
#include "common/parsing.h"
|
|
#include "detection/displayserver/displayserver.h"
|
|
#include "detection/gtk_qt/gtk_qt.h"
|
|
#include "font.h"
|
|
|
|
static void generateString(FFFontResult* font)
|
|
{
|
|
if(font->fonts[0].length > 0)
|
|
{
|
|
ffStrbufAppend(&font->display, &font->fonts[0]);
|
|
ffStrbufAppendS(&font->display, " [Qt]");
|
|
|
|
for(uint8_t i = 1; i < sizeof(font->fonts) / sizeof(font->fonts[0]); i++)
|
|
{
|
|
if(font->fonts[i].length > 0)
|
|
{
|
|
ffStrbufAppendS(&font->display, ", ");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
ffParseGTK(&font->display, &font->fonts[1], &font->fonts[2], &font->fonts[3]);
|
|
}
|
|
|
|
const char* ffDetectFontImpl(FFFontResult* result)
|
|
{
|
|
const FFDisplayServerResult* wmde = ffConnectDisplayServer();
|
|
|
|
if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0)
|
|
return "Font isn't supported in TTY";
|
|
|
|
FFfont qt;
|
|
ffFontInitQt(&qt, ffDetectQt()->font.chars);
|
|
ffStrbufAppend(&result->fonts[0], &qt.pretty);
|
|
ffFontDestroy(&qt);
|
|
|
|
FFfont gtk2;
|
|
ffFontInitPango(>k2, ffDetectGTK2()->font.chars);
|
|
ffStrbufAppend(&result->fonts[1], >k2.pretty);
|
|
ffFontDestroy(>k2);
|
|
|
|
FFfont gtk3;
|
|
ffFontInitPango(>k3, ffDetectGTK3()->font.chars);
|
|
ffStrbufAppend(&result->fonts[2], >k3.pretty);
|
|
ffFontDestroy(>k3);
|
|
|
|
FFfont gtk4;
|
|
ffFontInitPango(>k4, ffDetectGTK4()->font.chars);
|
|
ffStrbufAppend(&result->fonts[3], >k4.pretty);
|
|
ffFontDestroy(>k4);
|
|
|
|
generateString(result);
|
|
|
|
return NULL;
|
|
}
|