mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bugfix: match Chinese fonts in mdhl
This commit is contained in:
parent
510fef8cc2
commit
bf55ba01ce
14
src/main.cpp
14
src/main.cpp
@ -40,9 +40,10 @@ void VLogger(QtMsgType type, const QMessageLogContext &context, const QString &m
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(QT_NO_DEBUG)
|
#if defined(QT_NO_DEBUG)
|
||||||
|
Q_UNUSED(context);
|
||||||
|
|
||||||
QTextStream stream(&g_logFile);
|
QTextStream stream(&g_logFile);
|
||||||
stream << header << localMsg << "\n";
|
stream << header << localMsg << "\n";
|
||||||
g_logFile.flush();
|
|
||||||
|
|
||||||
if (type == QtFatalMsg) {
|
if (type == QtFatalMsg) {
|
||||||
g_logFile.close();
|
g_logFile.close();
|
||||||
@ -75,6 +76,8 @@ void VLogger(QtMsgType type, const QMessageLogContext &context, const QString &m
|
|||||||
header.toStdString().c_str(), file, context.line, localMsg.constData());
|
header.toStdString().c_str(), file, context.line, localMsg.constData());
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fflush(stderr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +95,11 @@ int main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTextCodec *codec = QTextCodec::codecForName("UTF8");
|
||||||
|
if (codec) {
|
||||||
|
QTextCodec::setCodecForLocale(codec);
|
||||||
|
}
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
vconfig.initialize();
|
vconfig.initialize();
|
||||||
|
|
||||||
@ -112,10 +120,6 @@ int main(int argc, char *argv[])
|
|||||||
app.installTranslator(&translator);
|
app.installTranslator(&translator);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextCodec *codec = QTextCodec::codecForName("UTF8");
|
|
||||||
if (codec) {
|
|
||||||
QTextCodec::setCodecForLocale(codec);
|
|
||||||
}
|
|
||||||
VMainWindow w;
|
VMainWindow w;
|
||||||
QString style = VUtils::readFileFromDisk(":/resources/vnote.qss");
|
QString style = VUtils::readFileFromDisk(":/resources/vnote.qss");
|
||||||
if (!style.isEmpty()) {
|
if (!style.isEmpty()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
font-family: Helvetica, sans-serif, Tahoma, Arial, Verdana, Geneva, Georgia, Palatino, "Times New Roman", "Hiragino Sans GB", "冬青黑体", STXihei, "华文细黑", "Microsoft YaHei", "微软雅黑", "WenQuanYi Micro Hei", "文泉驿雅黑", Dengxian, "等线体", "Liberation Sans", "Droid Sans", NSimSun, "新宋体", SimSun, "宋体";
|
font-family: Helvetica, sans-serif, Tahoma, Arial, Verdana, Geneva, Georgia, Palatino, "Times New Roman", "Hiragino Sans GB", "冬青黑体", "Microsoft YaHei", "微软雅黑", "Microsoft YaHei UI", "WenQuanYi Micro Hei", "文泉驿雅黑", Dengxian, "等线体", STXihei, "华文细黑", "Liberation Sans", "Droid Sans", NSimSun, "新宋体", SimSun, "宋体";
|
||||||
color: #444444;
|
color: #444444;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
editor
|
editor
|
||||||
# QTextEdit just choose the first available font, so specify the Chinese fonts first
|
# QTextEdit just choose the first available font, so specify the Chinese fonts first
|
||||||
# Do not use "" to quote the name
|
# Do not use "" to quote the name
|
||||||
font-family: Hiragino Sans GB, 冬青黑体, STXihei, 华文细黑, Microsoft YaHei, 微软雅黑, WenQuanYi Micro Hei, 文泉驿雅黑, Dengxian, 等线体, Liberation Sans, Droid Sans, NSimSun, 新宋体, SimSun, 宋体, Helvetica, sans-serif, Tahoma, Arial, Verdana, Geneva, Georgia, Times New Roman
|
font-family: Hiragino Sans GB, 冬青黑体, Microsoft YaHei, 微软雅黑, Microsoft YaHei UI, WenQuanYi Micro Hei, 文泉驿雅黑, Dengxian, 等线体, STXihei, 华文细黑, Liberation Sans, Droid Sans, NSimSun, 新宋体, SimSun, 宋体, Helvetica, sans-serif, Tahoma, Arial, Verdana, Geneva, Georgia, Times New Roman
|
||||||
|
|
||||||
editor-selection
|
editor-selection
|
||||||
foreground: eeeeee
|
foreground: eeeeee
|
||||||
|
@ -272,11 +272,13 @@ QString VStyleParser::filterAvailableFontFamily(const QString &familyList) const
|
|||||||
|
|
||||||
qDebug() << "family:" << familyList;
|
qDebug() << "family:" << familyList;
|
||||||
for (int i = 0; i < families.size(); ++i) {
|
for (int i = 0; i < families.size(); ++i) {
|
||||||
QString family = families[i].trimmed().toLower();
|
QString family = families[i].trimmed();
|
||||||
for (int j = 0; j < availFamilies.size(); ++j) {
|
for (int j = 0; j < availFamilies.size(); ++j) {
|
||||||
QString availFamily = availFamilies[j];
|
QString availFamily = availFamilies[j];
|
||||||
availFamily.remove(QRegExp("\\[.*\\]"));
|
availFamily.remove(QRegExp("\\[.*\\]"));
|
||||||
if (family == availFamily.trimmed().toLower()) {
|
availFamily = availFamily.trimmed();
|
||||||
|
if (family == availFamily
|
||||||
|
|| family.toLower() == availFamily.toLower()) {
|
||||||
qDebug() << "matched family:" << availFamilies[j];
|
qDebug() << "matched family:" << availFamilies[j];
|
||||||
return availFamilies[j];
|
return availFamilies[j];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user