D27380: [GTK Config] Write Font without style name

2020-02-17 Thread Mikhail Zolotukhin
gikari updated this revision to Diff 75858.
gikari edited the summary of this revision.
gikari added a comment.


  Use big helper function for constructing font style. Please test, many fonts 
may break and not work.

REPOSITORY
  R99 KDE Gtk Configuration Tool

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27380?vs=75634&id=75858

BRANCH
  font-style

REVISION DETAIL
  https://phabricator.kde.org/D27380

AFFECTED FILES
  kded/configvalueprovider.cpp
  kded/configvalueprovider.h

To: gikari, #plasma, ervin, bport, meven
Cc: davidre, davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, 
LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, 
ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-17 Thread Benjamin Port
bport added a comment.


  I just read bug report again and the from seems to came from , not from 
localization.
  
  By the way I neved end with localized style, how do you achieve that ? (I 
mean even in UI)

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: davidre, davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, 
LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, 
ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-17 Thread Benjamin Port
bport added a comment.


  I think a good fix can be to use @davidedmundson solution combined with a 
check to know if font styleName is not set (if it set it will be not translated.
  
  I think
  QFont yourFont = QFont(...);
  auto f = QFontInfo(youFont)
  f.styleName(); <<=  is in theory empty if it's not enforced. In other case 
stuff based on enum will be ok. Goal of style name is to express "irregular" 
style name according to Qt documentation

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: davidre, davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, 
LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, 
ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-17 Thread Kevin Ottens
ervin added a comment.


  Can we give a shot to @davidedmundson proposal? Maybe slightly extended to 
cover some extra enum cases if necessary?

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: davidre, davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, 
LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, 
ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-14 Thread David Redondo
davidre added a comment.


  Stretch is in https://doc.qt.io/qt-5/qfont.html#Stretch-enum

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: davidre, davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, 
LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, 
ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-14 Thread Mikhail Zolotukhin
gikari added a comment.


  In D27380#611204 , @davidedmundson 
wrote:
  
  > Take this code
  
  
  How about other styles, such as Condensed, Book etc?
  
  F8103081: Screenshot_20200214_114315.png 


REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, 
LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, 
ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread David Edmundson
davidedmundson added a comment.


  Take this code:
  
static QString styleStringHelper(int weight, QFont::Style style)
{
QString result;
if (weight > QFont::Normal) {
if (weight >= QFont::Black)
result = QCoreApplication::translate("QFontDatabase", "Black");
else if (weight >= QFont::ExtraBold)
result = QCoreApplication::translate("QFontDatabase", "Extra 
Bold");
else if (weight >= QFont::Bold)
result = QCoreApplication::translate("QFontDatabase", "Bold");
else if (weight >= QFont::DemiBold)
result = QCoreApplication::translate("QFontDatabase", "Demi 
Bold");
else if (weight >= QFont::Medium)
result = QCoreApplication::translate("QFontDatabase", "Medium", 
"The Medium font weight");
} else {
if (weight <= QFont::Thin)
result = QCoreApplication::translate("QFontDatabase", "Thin");
else if (weight <= QFont::ExtraLight)
result = QCoreApplication::translate("QFontDatabase", "Extra 
Light");
else if (weight <= QFont::Light)
result = QCoreApplication::translate("QFontDatabase", "Light");
}

if (style == QFont::StyleItalic)
result += QLatin1Char(' ') + 
QCoreApplication::translate("QFontDatabase", "Italic");
else if (style == QFont::StyleOblique)
result += QLatin1Char(' ') + 
QCoreApplication::translate("QFontDatabase", "Oblique");

if (result.isEmpty())
result = QCoreApplication::translate("QFontDatabase", "Normal", 
"The Normal or Regular font weight");

return result.simplified();
}
  
  Drop the QCoreApplication::translate("QFontDatabase", "  stuff, and it should 
work fine.

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, 
LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, 
ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Nathaniel Graham
ngraham added a comment.


  *groan*
  
  I guess we need to fix it Qt then. I don't know much about fonts but maybe it 
could display the localized string in the UI but write an un-localized version 
to the config file? Would that work? And then maybe we can somehow finally fix 
https://bugs.kde.org/show_bug.cgi?id=378523.

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, LeGast00n, 
The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, 
ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Mikhail Zolotukhin
gikari added a comment.


  In D27380#611150 , @ngraham wrote:
  
  > So maybe that's something we can fix in the Fonts KCM? Or Is it caused by 
the Qt bug ultimately causing https://bugs.kde.org/show_bug.cgi?id=378523?
  
  
  Probably a Qt bug, because Fonts KCM uses QtDialogs.FontDialog, and there is 
already the localized style displayed at **some** fonts.
  F8101873: image.png 

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, LeGast00n, 
The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, 
ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Nathaniel Graham
ngraham added a comment.


  In D27380#611146 , @gikari wrote:
  
  > In D27380#611132 , @ngraham 
wrote:
  >
  > > Is the problem that the style name is already localized by the time we 
get it from the Fonts KCM?
  >
  >
  > Yes. It's already displayed localized, so that I cannot do anything with it.
  
  
  So maybe that's something we can fix in the Fonts KCM? Or Is it caused by the 
Qt bug ultimately causing https://bugs.kde.org/show_bug.cgi?id=378523?

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, LeGast00n, 
The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, 
ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Mikhail Zolotukhin
gikari added a comment.


  In D27380#611132 , @ngraham wrote:
  
  > Is the problem that the style name is already localized by the time we get 
it from the Fonts KCM?
  
  
  Yes. It's already displayed localized, so that I cannot do anything with it.

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, LeGast00n, 
The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, 
ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Christoph Feck
cfeck added a comment.


  So... is this all related to bug https://bugs.kde.org/show_bug.cgi?id=378523 ?
  :/

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, LeGast00n, 
The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, 
ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, 
sebas, apol, ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Nathaniel Graham
ngraham added a comment.


  In D27380#611031 , @IlyaBizyaev 
wrote:
  
  > I don't understand the problem in-depth, but isn't it possible to write 
non-localized style name instead?
  
  
  Indeed.
  
  Is the problem that the style name is already localized by the time we get it 
from the Fonts KCM?

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari
Cc: ngraham, IlyaBizyaev, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, 
cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, alexeymin, 
himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, 
ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Ilya Bizyaev
IlyaBizyaev added a comment.


  I don't understand the problem in-depth, but isn't it possible to write 
non-localized style name instead?

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari
Cc: IlyaBizyaev, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, 
jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, 
himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, 
ahiemstra, mart


D27380: [GTK Config] Write Font without style name

2020-02-13 Thread Mikhail Zolotukhin
gikari created this revision.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
gikari requested review of this revision.

REVISION SUMMARY
  It has been reported, that on localized systems
  the font style was written in local language.
  Therefore config line was incorrectly read by
  GTK and therefore applications displayed bad
  font. To avoid that this commit is introduced.
  
  This is not an ideal solution, because the selected
  font style in font dialog will be ignored by GTK applications.
  However, there is a workaround for that: you need to select a
  font with the style in its family name. For example: "Inter"
  with style "Medium" will be "Inter Medium". But some styles
  do not have these "clones", e.g. Regular, Bold and Italic.
  
  At least ignored style with very easy workaround is better, than
  no ability to correctly apply a font at all with a very tedious
  workaround aka "manually editing a lot of GTK config files and options".

TEST PLAN
  1. Apply fonts with style and see, that it is not propagated to GTK configs.
  2. Apply fonts with the same styles in their family name to see, that they 
are working correctly.

REPOSITORY
  R99 KDE Gtk Configuration Tool

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D27380

AFFECTED FILES
  kded/configvalueprovider.cpp

To: gikari
Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, 
fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart