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

Authored by xuetianweng on Sat, Nov 16, 5:19 PM.

Details

Reviewers
cullmann
dhaumann
Group Reviewers
KTextEditor
Summary

When a font has fallback, the fontHeight is broken can may cut the string
in the middle in the line. Try to use some representive character from multiple
languages to estimate the actual fontHeight.

BUG: 404907

Test Plan

Manually tested.

Diff Detail

Repository
R39 KTextEditor
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 18854
Build 18872: arc lint + arc unit
xuetianweng requested review of this revision.Sat, Nov 16, 5:19 PM
xuetianweng created this revision.

Add comment about the actual characters.

Add screenshot to demonstrate the problem.

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.
So this could be a common problem for them to see the "half character".

The issue with this approach is, that you get "too high" lines for the case that none of this characters ever appear.
Beside that, unfortunately, you get rendering artifacts in addition, as Qt will not paint e.g. selection high enough for lines without such chars.

See e.g. attached screenshot.

xuetianweng added a comment.EditedSun, Nov 17, 8:42 PM

Any idea about how konsole derive the value?.. I'm not so sure if they did a better job (probably not because IIRC I have seen similar issue in konsole).

The issue with this approach is, that you get "too high" lines for the case that none of this characters ever appear.
Beside that, unfortunately, you get rendering artifacts in addition, as Qt will not paint e.g. selection high enough for lines without such chars.

See e.g. attached screenshot.

Then what is the ideal solution to you for this case?

Having different font height for every line? Or keep this "slightly higher line" by do vertical center align and fix the artifact?

At least the current state doesn't look right to me and I think it need to be fixed.

Having different font height for every line?

  1. We don't want a bigger lines
  2. We don't want a lines that are bigger that other in a view.
  3. We don't want different font height in a view.

I don't know which is best.

Actually, I could live with:

  1. All lines are a bit higher, for me that makes reading even easier. But the rendering shall have no glitches.
  2. Some lines have different heights. But I assume this is hard to implement at the moment.