Bug 472502

Summary: line-height: normal may be too small for some fonts
Product: [Applications] krita Reporter: Alvin Wong <alvin>
Component: Tool/TextAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: screenshots

Description Alvin Wong 2023-07-22 15:43:39 UTC
Created attachment 160450 [details]
screenshots

For example, Microsoft JhengHei (built-in Traditiona Chinese font on Windows) looks a bit too tight. FIrefox/Chrome appears to use taller metrics.

Font metrics:

Win Ascent: 2203
WIn Descent: 521
Typo Ascent: 1823
Typo Descent: -225
Typo Line Gap: 0
HHead Ascent: 2203
HHead Descent: -521
HHead Line Gap: 0
VHead Column Spacing: 0
Capital Height: 1549
X Height: 1106
Comment 1 Alvin Wong 2023-08-12 14:05:17 UTC
Looks like Source Han Sans has a similar problem.
Comment 2 Bug Janitor Service 2023-08-18 18:01:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1906
Comment 3 Alvin Wong 2023-08-27 16:47:06 UTC
Git commit 2e1bc2bfbd124693d3e7a0848788b670fd730804 by Alvin Wong.
Committed on 27/08/2023 at 18:46.
Pushed by alvinwong into branch 'master'.

text: Also consider HHEA metrics for default line height

If USE_TYPO_METRICS is not set, also get the HHEA
ascender/descender/lineGap metrics, then compare it with the OS/2 sTypo
metrics and choose the larger line height. This fixes certain fonts
having a default line height that is too tight (e.g. Microsoft JhengHei,
Source Han Sans).

M  +23   -8    libs/flake/text/KoSvgTextShape_p_layout.cpp

https://invent.kde.org/graphics/krita/-/commit/2e1bc2bfbd124693d3e7a0848788b670fd730804
Comment 4 Alvin Wong 2023-08-27 16:47:54 UTC
Git commit 5f00891204e41a0880dd593bf16b996561c55c1a by Alvin Wong.
Committed on 27/08/2023 at 18:47.
Pushed by alvinwong into branch 'krita/5.2'.

text: Also consider HHEA metrics for default line height

If USE_TYPO_METRICS is not set, also get the HHEA
ascender/descender/lineGap metrics, then compare it with the OS/2 sTypo
metrics and choose the larger line height. This fixes certain fonts
having a default line height that is too tight (e.g. Microsoft JhengHei,
Source Han Sans).
(cherry picked from commit 2e1bc2bfbd124693d3e7a0848788b670fd730804)

M  +23   -8    libs/flake/text/KoSvgTextShape_p_layout.cpp

https://invent.kde.org/graphics/krita/-/commit/5f00891204e41a0880dd593bf16b996561c55c1a