mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-28 07:44:06 +01:00
TerminalFont (Linux): uses ffFontInitXft to parse foot terminal font
Fixes #2624
This commit is contained in:
@@ -10,6 +10,7 @@ Bugfixes:
|
||||
* Fixed `--config`/`-c` bash completion offering one candidate per word instead of one candidate per file for paths containing spaces. (Completion, Bash)
|
||||
* Fixed external monitors detected via DDC/CI being randomly reported as built-in, and libddcutil trace messages occasionally leaking into the output and breaking `--format json`. (#2615, Brightness / Linux)
|
||||
* Fixed the Vulkan driver name being concatenated with the driver name of a previously enumerated device on systems with more than one GPU. (#2619, Vulkan)
|
||||
* Fixed the Foot terminal font size not being parsed when written in the `Font Name-size` syntax, e.g. `Berkeley Mono-12`. (#2624, TerminalFont / Linux)
|
||||
|
||||
# 2.69.0
|
||||
|
||||
|
||||
@@ -211,27 +211,17 @@ static void detectFootTerminal(FFTerminalFontResult* terminalFont) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sarasa Term SC Nerd:size=8
|
||||
uint32_t colon = ffStrbufFirstIndexC(&font, ':');
|
||||
if (colon == font.length) {
|
||||
ffFontInitValues(&terminalFont->font, font.chars, "8");
|
||||
return;
|
||||
}
|
||||
uint32_t equal = ffStrbufNextIndexS(&font, colon, "size=");
|
||||
font.chars[colon] = '\0';
|
||||
if (equal == font.length) {
|
||||
ffFontInitValues(&terminalFont->font, font.chars, "8");
|
||||
return;
|
||||
}
|
||||
uint32_t size = equal + (uint32_t) strlen("size=");
|
||||
uint32_t comma = ffStrbufNextIndexC(&font, size, ',');
|
||||
if (comma < font.length) {
|
||||
// foot splits the font list on commas to specify fallback fonts.
|
||||
// Each entry is a fontconfig pattern, e.g. "Berkeley Mono-12" or "Sarasa Term SC Nerd:size=8".
|
||||
uint32_t comma = ffStrbufFirstIndexC(&font, ',');
|
||||
if (comma != font.length) {
|
||||
if (comma + 1 < font.length) {
|
||||
ffFontInitXft(&terminalFont->fallback, &font.chars[comma + 1]);
|
||||
}
|
||||
font.chars[comma] = '\0';
|
||||
ffStrbufRecalculateLength(&font);
|
||||
}
|
||||
ffFontInitValues(&terminalFont->font, font.chars, &font.chars[size]);
|
||||
if (comma < font.length) {
|
||||
ffFontInitValues(&terminalFont->fallback, &font.chars[comma + 1], nullptr);
|
||||
}
|
||||
ffFontInitXft(&terminalFont->font, font.chars);
|
||||
}
|
||||
|
||||
static void detectQTerminal(FFTerminalFontResult* terminalFont) {
|
||||
@@ -312,21 +302,8 @@ static void detectSt(FFTerminalFontResult* terminalFont, const FFTerminalResult*
|
||||
}
|
||||
}
|
||||
|
||||
// JetBrainsMono Nerd Font Mono:pixelsize=12:antialias=true:autohint=true
|
||||
|
||||
uint32_t index = ffStrbufFirstIndexC(&font, ':');
|
||||
if (index != font.length) {
|
||||
uint32_t sIndex = ffStrbufNextIndexS(&font, index + 1, "size=");
|
||||
if (sIndex != font.length) {
|
||||
sIndex += (uint32_t) strlen("size=");
|
||||
uint32_t sIndexEnd = ffStrbufNextIndexC(&font, sIndex, ':');
|
||||
ffStrbufSetNS(&size, sIndexEnd - sIndex, font.chars + sIndex);
|
||||
}
|
||||
ffStrbufSubstrBefore(&font, index);
|
||||
} else {
|
||||
ffStrbufClear(&size);
|
||||
}
|
||||
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
|
||||
// e.g. "JetBrainsMono Nerd Font Mono:pixelsize=12:antialias=true:autohint=true"
|
||||
ffFontInitXft(&terminalFont->font, font.chars);
|
||||
}
|
||||
|
||||
static void detectWarp(FFTerminalFontResult* terminalFont) {
|
||||
|
||||
Reference in New Issue
Block a user