Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix hiding axes and also set a label for optical size.

Wolthera van Hövell tot Westerflier7751f32876d5
diff --git a/plugins/dockers/textproperties/FontAxesModel.cpp b/plugins/dockers/textproperties/FontAxesModel.cpp
index 04ea5f8ca0..640a325f90 100644
--- a/plugins/dockers/textproperties/FontAxesModel.cpp
+++ b/plugins/dockers/textproperties/FontAxesModel.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "FontAxesModel.h"
+#include <klocalizedstring.h>
#include <QDebug>
const QString WEIGHT_TAG = "wght";
@@ -41,7 +42,8 @@ void FontAxesModel::setAxesData(QList<KoSvgText::FontFamilyAxis> axes)
if (!(tag == WEIGHT_TAG
|| tag == WIDTH_TAG
|| tag == ITALIC_TAG
- || tag == SLANT_TAG)) {
+ || tag == SLANT_TAG)
+ && !axes.at(i).axisHidden) {
d->axes.append(axes.at(i));
}
}
@@ -100,7 +102,13 @@ QVariant FontAxesModel::data(const QModelIndex &index, int role) const
KoSvgText::FontFamilyAxis axis = d->axes.at(index.row());
if (role == Qt::DisplayRole) {
- if (axis.localizedLabels.isEmpty()) return axis.tag;
+ if (axis.tag == OPTICAL_TAG){
+ // Refers to https://learn.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_opsz
+ return i18nc("@info:label", "Optical Size");
+ }
+ if (axis.localizedLabels.isEmpty()) {
+ return axis.tag;
+ }
QString label = axis.localizedLabels.value(QLocale(QLocale::English), axis.localizedLabels.values().first());
Q_FOREACH(const QLocale &locale, d->locales) {
if (axis.localizedLabels.keys().contains(locale)) {