Bug 430712 - Line numbers are not displayed properly
Summary: Line numbers are not displayed properly
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Microsoft Windows Microsoft Windows
: NOR major
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-22 17:19 UTC by Waqar Ahmed
Modified: 2021-02-21 12:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.80.0
Sentry Crash Report:


Attachments
Line numbers cut off (6.68 KB, image/png)
2020-12-22 17:19 UTC, Waqar Ahmed
Details
Issue with Hack 12 pt, Windows (42.90 KB, image/png)
2021-02-20 19:39 UTC, magiblot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Waqar Ahmed 2020-12-22 17:19:00 UTC
Created attachment 134268 [details]
Line numbers cut off

SUMMARY

Line numbers in line number area are not displayed properly on windows if there are more than 1 digit. You see the last digits but the first one is slightly cut off.


STEPS TO REPRODUCE
1. Open kate with a file that has line > 10
2. See that the first digit is cut off

OBSERVED RESULT

1.5 digits displayed out of 2 :/

EXPECTED RESULT

2 out of 2 digits clearly visible

SOFTWARE/OS VERSIONS

Windows: Windows 10 Pro Version 2004, Build 19041.685
Kate version: 20.08.1
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1

ADDITIONAL INFORMATION

Installed from Windows Store
Comment 1 Dominik Haumann 2020-12-22 22:38:00 UTC
Which font do you use and what font size?
Comment 2 Waqar Ahmed 2020-12-23 11:12:41 UTC
Courier New, Size 9.0

Increasing the size makes it a bit better but the issue remains.

Changing the font to Consolas resolves the issue completely.
Comment 3 Waqar Ahmed 2021-01-13 14:05:08 UTC
This only seems to happen with Courier New, I have tried other fonts but can't reproduce. A work around is to use "Icon Border". Also, this happens regardless of OS, reproducible on Linux as well.

As a suggestion, We should default to some other font on windows to avoid this problem.
Comment 4 magiblot 2021-02-20 18:59:49 UTC
I'm having this issue on Windows with the Hack font.
Comment 5 Waqar Ahmed 2021-02-20 19:01:59 UTC
Which version of Kate are you using and font size?
Comment 6 magiblot 2021-02-20 19:39:36 UTC
Created attachment 135987 [details]
Issue with Hack 12 pt, Windows

The problem persists after updating to 20.12.2 (despite the fact that doing so overwrote my font settings and removed my schema customizations :/).

The font size is 12. But I have only seen this issue on Windows so far. The default Kate font on Arch Linux is Hack and I have no such issue there.
Comment 7 Christoph Cullmann 2021-02-21 12:02:30 UTC
I think we use the wrong function to compute the sizes for the line numbers, will alter that.
Comment 8 Christoph Cullmann 2021-02-21 12:04:26 UTC
Git commit cf52ca1ff83fdf7db3b709d7b2dd93d7884754da by Christoph Cullmann.
Committed on 21/02/2021 at 12:03.
Pushed by cullmann into branch 'master'.

use correct function to determine with of line number characters

tested locally, this yields often 1 or 2 extra pixels
compared to what we did before

M  +2    -2    src/view/kateannotationitemdelegate.cpp
M  +3    -4    src/view/kateviewhelpers.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/cf52ca1ff83fdf7db3b709d7b2dd93d7884754da