D25339: KateRenderer: Use representitive character in CJK to estimate the fontHeight.

Shinjo Park noreply at phabricator.kde.org
Mon May 4 20:39:26 BST 2020


pshinjo added a comment.


  In D25339#563370 <https://phabricator.kde.org/D25339#563370>, @xuetianweng wrote:
  
  > And what I'd like to point is, for CJK users, it is uncommon for them to select a single font to cover all the characters, because such fonts are really rare. People usually select one latin only font and just let system (fontconfig) select the fallback for them.
  
  
  This statement is valid even for non-CJK users who only occasionally see the said characters.
  
  For all screenshots, left hand side is git master+this patch, right hand side is Kate 19.12.3/Frameworks 5.68.0 on Ubuntu 20.04.
  
  Test 1 - Hack + Noto Sans Mono CJK KR 9pt (Hack does not contain CJK glyphs, so for missing glyphs the latter will be used). Notice that only in the left hand side the underline in my e-mail address is visible:
  
  F8284453: Screenshot_20200504_210144.png <https://phabricator.kde.org/F8284453>
  
  Test 2 - Nanum Square 9pt (contains both Latin-1 and Korean glyphs):
  
  F8284455: Screenshot_20200504_210313.png <https://phabricator.kde.org/F8284455>
  
  Test 3 - Ubuntu Mono + Noto Sans Mono CJK KR 9pt. For me the right hand side is a regression, since neither Cyrillic nor Korean scripts are clearly visible when both of them are in the same line. Also in this setup most of Korean texts are cut by half even when there are only Korean texts. Compare it with the other lines where only Cyrillic is visible:
  
  F8284485: Screenshot_20200504_213506.png <https://phabricator.kde.org/F8284485>
  
  I can also confirm about 6-7 lines of loss, but for me the right hand side has issues. Need to find some compromise.

INLINE COMMENTS

> katerenderer.cpp:1040
>      m_fontHeight = qMax(1, qCeil(m_fontMetrics.ascent() + m_fontMetrics.descent()));
> +    // Try to use representitve character from English, Chinese, Japanese
> +    // and Korean to calculate the line height.

I think this causes the regression mentioned in

In D25339#663322 <https://phabricator.kde.org/D25339#663322>, @rjvbb wrote:

> I can't speak for the special cases where this change would improve matters, but for me it introduces a clear regression (waste of vertical space: 12 lines less) in a basic ascii code editing context. Font used is Ubuntu Mono 10pt.


But this part is the raison d'etre for this patch: provide enough font height for non-latin-1 text. Also not considered is glyphs from other scripts, such as Cyrillic, Arabic, ... What could be another solution?

REPOSITORY
  R39 KTextEditor

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

To: xuetianweng, #ktexteditor, cullmann, dhaumann, #frameworks, rjvbb
Cc: pshinjo, rjvbb, fakefred, anthonyfieroni, kde-frameworks-devel, kwrite-devel, rrosch, LeGast00n, cblack, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20200504/8296ccf5/attachment.html>


More information about the KWrite-Devel mailing list