1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2026-02-08 00:32:27 +00:00

Fix system fonts not always visible.

This commit is contained in:
Filippo Scognamiglio
2025-12-14 23:32:03 +01:00
parent ef11a4b7ef
commit 4faa6d522d
3 changed files with 5 additions and 11 deletions

View File

@@ -33,8 +33,6 @@ void MonospaceFontManager::setFontSubstitution(const QString &family, const QStr
QFont::removeSubstitutions(family);
QFont::insertSubstitution(family, substitute);
qDebug() << "Font substitution set:" << family << "->" << substitute;
}
void MonospaceFontManager::removeFontSubstitution(const QString &family)
@@ -44,5 +42,4 @@ void MonospaceFontManager::removeFontSubstitution(const QString &family)
}
QFont::removeSubstitutions(family);
qDebug() << "Font substitution removed for:" << family;
}

View File

@@ -132,11 +132,9 @@ QtObject {
property var filteredFontList: ListModel {}
// Single method that updates the font list and applies changes to terminal
function updateFont() {
if (!fontManager.item || !fontlist) return
// Step 1: Update filtered font list
filteredFontList.clear()
var currentFontInList = false
@@ -145,14 +143,14 @@ QtObject {
var isBundled = !font.isSystemFont
var isSystem = font.isSystemFont
// Filter by font source (bundled vs system)
var matchesSource = (fontSource === bundled_fonts && isBundled) ||
(fontSource === system_fonts && isSystem)
if (!matchesSource) continue
// For non-default rasterization, only show low-resolution fonts
var matchesRasterization = (rasterization === no_rasterization) || font.lowResolutionFont
var matchesRasterization = font.isSystemFont ||
(rasterization === no_rasterization) ||
font.lowResolutionFont
if (matchesRasterization) {
filteredFontList.append(font)
@@ -162,12 +160,10 @@ QtObject {
}
}
// Step 2: If current font is not in the filtered list, select the first available font
if (!currentFontInList && filteredFontList.count > 0) {
fontName = filteredFontList.get(0).name
}
// Step 3: Apply font to terminal
var index = getIndexByName(fontName)
if (index === undefined) return

View File

@@ -226,13 +226,14 @@ QtObject {
Component.onCompleted: addSystemFonts()
function addSystemFonts() {
var families = monospaceSystemFonts
var families = monospaceSystemFonts;
for (var i = 0; i < families.length; i++) {
if (verbose) {
console.log("Adding system font: ", families[i])
}
fontlist.append(convertToListElement(families[i]))
}
appSettings.updateFont();
}
function convertToListElement(family) {