Commit c61fa31d authored by Gus Grubba's avatar Gus Grubba

Add fonts for Korean

Fixed places where the font family was not being defined (therefore using the default system font)
parent 0cace323
......@@ -12,6 +12,8 @@
<qresource prefix="/fonts">
<file alias="opensans">resources/fonts/OpenSans-Regular.ttf</file>
<file alias="opensans-demibold">resources/fonts/OpenSans-Semibold.ttf</file>
<file alias="NanumGothic-Regular">resources/fonts/NanumGothic-Regular.ttf</file>
<file alias="NanumGothic-Bold">resources/fonts/NanumGothic-Bold.ttf</file>
</qresource>
<qresource prefix="/qmlimages">
<file alias="AirframeComponentIcon.png">src/AutoPilotPlugins/Common/Images/AirframeComponentIcon.png</file>
......
......@@ -477,8 +477,15 @@ bool QGCApplication::_initForNormalAppBoot()
//-- See App.SettinsGroup.json for index
int langID = toolbox()->settingsManager()->appSettings()->language()->rawValue().toInt();
//-- Don't load custom fonts if not using standard character set
if(langID != 6 /*Korean*/ && langID != 9 /*Chinese*/) {
//-- Load font appropriate for the language
if(langID == 6 /*Korean*/) {
if(QFontDatabase::addApplicationFont(":/fonts/NanumGothic-Regular") < 0) {
qWarning() << "Could not load /fonts/NanumGothic-Regular font";
}
if(QFontDatabase::addApplicationFont(":/fonts/NanumGothic-Bold") < 0) {
qWarning() << "Could not load /fonts/NanumGothic-Bold font";
}
} else {
if(QFontDatabase::addApplicationFont(":/fonts/opensans") < 0) {
qWarning() << "Could not load /fonts/opensans font";
}
......
......@@ -28,6 +28,7 @@ CheckBox {
text: control.text
font.pointSize: textFontPointSize
font.bold: control.textBold
font.family: ScreenTools.normalFontFamily
color: control.textColor
anchors.centerIn: parent
}
......@@ -43,7 +44,7 @@ CheckBox {
border.width: 1
opacity: control.checkedState === Qt.PartiallyChecked ? 0.5 : 1
QGCColoredImage {
source: "/qmlimages/checkbox-check.svg"
source: "/qmlimages/checkbox-check.svg"
color: "black"
opacity: control.checkedState === Qt.Checked ? (control.enabled ? 1 : 0.5) : 0
mipmap: true
......
......@@ -79,15 +79,14 @@ Button {
}
Text {
id: innerText
text: button.text
color: _currentContentColor
width: parent.width
font.pointSize: ScreenTools.defaultFontPointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
id: innerText
text: button.text
color: _currentContentColor
width: parent.width
font.family: ScreenTools.normalFontFamily
font.pointSize: ScreenTools.defaultFontPointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
} // Column - content
} // Item - content
......
......@@ -7,7 +7,6 @@ import QGroundControl.ScreenTools 1.0
Text {
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
font.pointSize: ScreenTools.defaultFontPointSize
font.family: ScreenTools.normalFontFamily
color: __qgcPal.text
......
......@@ -34,7 +34,8 @@ RadioButton {
}
contentItem: Text {
text: control.text
text: control.text
font.family: ScreenTools.normalFontFamily
font.pointSize: textFontPointSize
font.bold: control.textBold
color: control.textColor
......
......@@ -94,8 +94,8 @@ Item {
property real checkBoxIndicatorSize: Math.round(defaultFontPixelHeight * (isMobile ? 1.5 : 1.0))
property real radioButtonIndicatorSize: checkBoxIndicatorSize
readonly property string normalFontFamily: "opensans"
readonly property string demiboldFontFamily: "opensans-demibold"
readonly property string normalFontFamily: ScreenToolsController.normalFontFamily
readonly property string demiboldFontFamily: ScreenToolsController.boldFontFamily
readonly property string fixedFontFamily: ScreenToolsController.fixedFontFamily
/* This mostly works but for some reason, reflowWidths() in SetupView doesn't change size.
I've disabled (in release builds) until I figure out why. Changes require a restart for now.
......
......@@ -15,6 +15,8 @@
#include <QFontDatabase>
#include <QScreen>
#include "SettingsManager.h"
#if defined(__ios__)
#include <sys/utsname.h>
#endif
......@@ -41,3 +43,27 @@ ScreenToolsController::fixedFontFamily() const
{
return QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
}
QString
ScreenToolsController::normalFontFamily() const
{
//-- See App.SettinsGroup.json for index
int langID = qgcApp()->toolbox()->settingsManager()->appSettings()->language()->rawValue().toInt();
if(langID == 6 /*Korean*/) {
return QString("fonts/NanumGothic-Regular");
} else {
return QString("opensans");
}
}
QString
ScreenToolsController::boldFontFamily() const
{
//-- See App.SettinsGroup.json for index
int langID = qgcApp()->toolbox()->settingsManager()->appSettings()->language()->rawValue().toInt();
if(langID == 6 /*Korean*/) {
return QString("NanumGothic-Bold");
} else {
return QString("opensans-demibold");
}
}
......@@ -39,6 +39,8 @@ public:
Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT)
Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT)
Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT)
Q_PROPERTY(QString normalFontFamily READ normalFontFamily CONSTANT)
Q_PROPERTY(QString boldFontFamily READ boldFontFamily CONSTANT)
// Returns current mouse position
Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); }
......@@ -102,7 +104,8 @@ public:
QString iOSDevice () const;
QString fixedFontFamily () const;
QString normalFontFamily () const;
QString boldFontFamily () const;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment