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:
@@ -33,8 +33,6 @@ void MonospaceFontManager::setFontSubstitution(const QString &family, const QStr
|
|||||||
|
|
||||||
QFont::removeSubstitutions(family);
|
QFont::removeSubstitutions(family);
|
||||||
QFont::insertSubstitution(family, substitute);
|
QFont::insertSubstitution(family, substitute);
|
||||||
|
|
||||||
qDebug() << "Font substitution set:" << family << "->" << substitute;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonospaceFontManager::removeFontSubstitution(const QString &family)
|
void MonospaceFontManager::removeFontSubstitution(const QString &family)
|
||||||
@@ -44,5 +42,4 @@ void MonospaceFontManager::removeFontSubstitution(const QString &family)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFont::removeSubstitutions(family);
|
QFont::removeSubstitutions(family);
|
||||||
qDebug() << "Font substitution removed for:" << family;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,11 +132,9 @@ QtObject {
|
|||||||
|
|
||||||
property var filteredFontList: ListModel {}
|
property var filteredFontList: ListModel {}
|
||||||
|
|
||||||
// Single method that updates the font list and applies changes to terminal
|
|
||||||
function updateFont() {
|
function updateFont() {
|
||||||
if (!fontManager.item || !fontlist) return
|
if (!fontManager.item || !fontlist) return
|
||||||
|
|
||||||
// Step 1: Update filtered font list
|
|
||||||
filteredFontList.clear()
|
filteredFontList.clear()
|
||||||
var currentFontInList = false
|
var currentFontInList = false
|
||||||
|
|
||||||
@@ -145,14 +143,14 @@ QtObject {
|
|||||||
var isBundled = !font.isSystemFont
|
var isBundled = !font.isSystemFont
|
||||||
var isSystem = font.isSystemFont
|
var isSystem = font.isSystemFont
|
||||||
|
|
||||||
// Filter by font source (bundled vs system)
|
|
||||||
var matchesSource = (fontSource === bundled_fonts && isBundled) ||
|
var matchesSource = (fontSource === bundled_fonts && isBundled) ||
|
||||||
(fontSource === system_fonts && isSystem)
|
(fontSource === system_fonts && isSystem)
|
||||||
|
|
||||||
if (!matchesSource) continue
|
if (!matchesSource) continue
|
||||||
|
|
||||||
// For non-default rasterization, only show low-resolution fonts
|
var matchesRasterization = font.isSystemFont ||
|
||||||
var matchesRasterization = (rasterization === no_rasterization) || font.lowResolutionFont
|
(rasterization === no_rasterization) ||
|
||||||
|
font.lowResolutionFont
|
||||||
|
|
||||||
if (matchesRasterization) {
|
if (matchesRasterization) {
|
||||||
filteredFontList.append(font)
|
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) {
|
if (!currentFontInList && filteredFontList.count > 0) {
|
||||||
fontName = filteredFontList.get(0).name
|
fontName = filteredFontList.get(0).name
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 3: Apply font to terminal
|
|
||||||
var index = getIndexByName(fontName)
|
var index = getIndexByName(fontName)
|
||||||
if (index === undefined) return
|
if (index === undefined) return
|
||||||
|
|
||||||
|
|||||||
@@ -226,13 +226,14 @@ QtObject {
|
|||||||
Component.onCompleted: addSystemFonts()
|
Component.onCompleted: addSystemFonts()
|
||||||
|
|
||||||
function addSystemFonts() {
|
function addSystemFonts() {
|
||||||
var families = monospaceSystemFonts
|
var families = monospaceSystemFonts;
|
||||||
for (var i = 0; i < families.length; i++) {
|
for (var i = 0; i < families.length; i++) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
console.log("Adding system font: ", families[i])
|
console.log("Adding system font: ", families[i])
|
||||||
}
|
}
|
||||||
fontlist.append(convertToListElement(families[i]))
|
fontlist.append(convertToListElement(families[i]))
|
||||||
}
|
}
|
||||||
|
appSettings.updateFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertToListElement(family) {
|
function convertToListElement(family) {
|
||||||
|
|||||||
Reference in New Issue
Block a user