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