SettingsDaemon: Improve language settings

pull/21/head
kateleet 5 years ago
parent 6be19a4576
commit 4b2433d4f0

@ -49,11 +49,18 @@ void Language::setLanguage(const QString &code)
}
QSettings settings(QStringLiteral("cutefishos"), QStringLiteral("theme"));
// 中文语言下更换字体
// Change fonts
if (code == "zh_CN") {
settings.setValue("Font", "Noto Sans CJK SC");
} else if (code.contains("en_")) {
settings.setValue("Font", "Noto Sans");
} else if (code == "zh_TW") {
settings.setValue("Font", "Noto Sans CJK TC");
} else if (code == "zh_HK") {
settings.setValue("Font", "Noto Serif CJK HK");
} else if (code == "ja_JP") {
settings.setValue("Font", "Noto Serif CJK JP");
}
m_settings->setValue("language", code);

@ -370,6 +370,10 @@ void ThemeManager::updateFontConfig()
const QString &fimilyFont = systemFont();
const QString &fixedFont = systemFixedFont();
QSettings settings(QSettings::UserScope, "cutefishos", "theme");
bool hinting = settings.value("XftAntialias", 1).toBool();
QString hintStyle = settings.value("XftHintStyle", "hintslight").toString();
QString content = QString("<?xml version=\"1.0\"?>"
"<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">"
"<fontconfig>"
@ -404,11 +408,22 @@ void ThemeManager::updateFontConfig()
"<match target=\"font\">"
"<edit name=\"rgba\"><const>rgb</const></edit>"
"</match>"
"<match target=\"font\">"
"<edit name=\"hinting\" mode=\"assign\">"
"<bool>%8</bool>"
"</edit>"
"</match>"
"<match target=\"font\">"
"<edit name=\"hintstyle\" mode=\"assign\">"
"<const>%9</const>"
"</edit>"
"</match>"
"</fontconfig>"
).arg(fimilyFont).arg(fimilyFont)
.arg(fimilyFont).arg(fimilyFont)
.arg(fixedFont).arg(fixedFont)
.arg(fimilyFont);
.arg(fimilyFont).arg(hinting ? "true" : "false")
.arg(hintStyle);
QString targetPath(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + QLatin1String("fontconfig"));

Loading…
Cancel
Save