Bug 425312

Summary: Text editor tool won't apply font variants even though they are on the list
Product: krita Reporter: kalia24
Component: Tool/TextAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, halla, srirupa.sps
Priority: NOR    
Version: 4.3.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description kalia24 2020-08-13 15:17:53 UTC
Having any font with variable weight (i.e. Light, Regular, Bold, etc.) will make you use only the default/Regular. If you try to change it, nothing happens.


STEPS TO REPRODUCE
1. Install a font with variable weights in your system (f.ex. Open Sans).
2. Try to use other weight than default/Regular - pick different weight from the drop-down list in Text Editor.

OBSERVED RESULT
Font weight won't change.

EXPECTED RESULT
Font weight changes.

SOFTWARE/OS VERSIONS
Windows 10
Comment 1 Ahab Greybeard 2020-08-13 18:12:17 UTC
I can confirm this for the Aug12 4.3.1-alpha (git dbf8a5d) and the Aug13 5.0.0-prealpha (git ab918e) appimages.

Tested with Tahoma, Times New Roman TMC  and Bodoni MT fonts.
Comment 2 Srirupa Datta 2021-05-18 22:32:12 UTC
Can I work on this?
Comment 3 Halla Rempt 2021-09-07 09:49:38 UTC
Sorry for the late reply, but sure, feel free!
Comment 4 wolthera 2021-11-16 16:39:44 UTC
Git commit 556d6a100039c9842d71283d8ab93024e016523c by Wolthera van Hövell tot Westerflier.
Committed on 16/11/2021 at 16:36.
Pushed by woltherav into branch 'wolthera/font-style-fixes'.

Improve font style selection, enabling the proper styles to be selected.

Apparantly Qt will synthesize the bold/italic if you don't set it on creation.
This patch also tries to fix the handling of stretch in the same way, however
it seems that all QFonts return 'anystretch' for the stretch, which makes me
suspect there's a qt bug there. In any case, the changes ensure that at the
least a coherent value is set (0 doesn't mean much).

M  +16   -11   libs/flake/text/KoSvgTextProperties.cpp
M  +38   -2    libs/flake/text/KoSvgTextShapeMarkupConverter.cpp
M  +1    -3    plugins/tools/svgtexttool/SvgTextEditor.cpp

https://invent.kde.org/graphics/krita/commit/556d6a100039c9842d71283d8ab93024e016523c
Comment 5 wolthera 2021-11-19 13:15:08 UTC
Git commit 5263feef992731c88139b71edb941987b4d5f8fc by Wolthera van Hövell, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 19/11/2021 at 13:15.
Pushed by woltherav into branch 'master'.

Improve font style selection, enabling the proper styles to be selected.

Apparantly Qt will synthesize the bold/italic if you don't set it on creation.
This patch also tries to fix the handling of stretch in the same way, however
it seems that all QFonts return 'anystretch' for the stretch, which makes me
suspect there's a qt bug there. In any case, the changes ensure that at the
least a coherent value is set (0 doesn't mean much).


(cherry picked from commit 556d6a100039c9842d71283d8ab93024e016523c)

M  +16   -11   libs/flake/text/KoSvgTextProperties.cpp
M  +38   -2    libs/flake/text/KoSvgTextShapeMarkupConverter.cpp
M  +1    -3    plugins/tools/svgtexttool/SvgTextEditor.cpp

https://invent.kde.org/graphics/krita/commit/5263feef992731c88139b71edb941987b4d5f8fc