Repository: fastfetch-cli/fastfetch
File: src/detection/terminalfont/terminalfont.c (C)

Code before:
    //Number of fonts found : 49
    //  path /usr/share/fonts/google-noto/NotoSansMono-Regular.ttf Regular Roman
    //  path ...

    uint32_t index = ffStrbufFirstIndexS(&buf, "Font description      : (family=");
    if(index >= buf.length) return false;
    index += (uint32_t) strlen("Font description      : (family=");
    ffStrbufSubstrBefore(&buf, ffStrbufNextIndexS(&buf, index, " weight="));
    ffFontInitCopy(&result->font, buf.chars + index);
    return true;
}

static bool detectRio(FFTerminalFontResult* terminalFont)
{
    FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
    FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();

    FFpropquery fontQueryToml[] = {
        {"family =", &fontName},
        {"size =", &fontSize},
    };

    ffParsePropFileConfigValues("rio/config.toml", 2, fontQueryToml);

    if(fontName.length == 0)
        ffStrbufAppendS(&fontName, "cascadiacode");

    if(fontSize.length == 0)
        ffStrbufAppendS(&fontSize, "18");

    ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);

    return true;
}

void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont);

static bool detectTerminalFontCommon(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
{
    if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "alacritty"))
        detectAlacritty(terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "wezterm-gui"))
        detectWezterm(&terminal->exe, terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "tabby"))
        detectTabby(terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "contour"))
        detectContour(&terminal->exe, terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "ghostty"))
        detectGhostty(terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "rio"))
        detectRio(terminalFont);

Review comment (suggestion):
```suggestion
        ffStrbufAppendS(&fontName, "Cascadia Code");
```

Code after:
    //Number of fonts found : 49
    //  path /usr/share/fonts/google-noto/NotoSansMono-Regular.ttf Regular Roman
    //  path ...

    uint32_t index = ffStrbufFirstIndexS(&buf, "Font description      : (family=");
    if(index >= buf.length) return false;
    index += (uint32_t) strlen("Font description      : (family=");
    ffStrbufSubstrBefore(&buf, ffStrbufNextIndexS(&buf, index, " weight="));
    ffFontInitCopy(&result->font, buf.chars + index);
    return true;
}

static bool detectRio(FFTerminalFontResult* terminalFont)
{
    FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
    FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();

    FFpropquery fontQueryToml[] = {
        {"family =", &fontName},
        {"size =", &fontSize},
    };

    ffParsePropFileConfigValues("rio/config.toml", 2, fontQueryToml);

    if(fontName.length == 0)
        ffStrbufAppendS(&fontName, "Cascadia Code");

    if(fontSize.length == 0)
        ffStrbufAppendS(&fontSize, "18");

    ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);

    return true;
}

void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont);

static bool detectTerminalFontCommon(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
{
    if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "alacritty"))
        detectAlacritty(terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "wezterm-gui"))
        detectWezterm(&terminal->exe, terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "tabby"))
        detectTabby(terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "contour"))
        detectContour(&terminal->exe, terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "ghostty"))
        detectGhostty(terminalFont);
    else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "rio"))
        detectRio(terminalFont);