eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

Show Print Margin bug for few fonts

Open rushi1698 opened this issue 2 years ago • 10 comments

I am seeing an unusual behavior with Show Print Margin option when I changed to a other font. I installed external font BIZ UDGothic When I changed default one to this and I select the option preferences-> text editors -> show print margin (80) there is extra padding in editor.

To Reproduce 1] Install BIZ UDGothic font (see attached zip -> download and double click on it -> install) 2] open attached TestRuler.txt file in eclipse (now it will have default font selected in my case Courier New) 3] Go to preferences -> text editors -> select Show print margin (80) 4] Now check the file it having extra padding.

Expected behavior It has to be same behavior like other fonts.

Screenshots See attached screenshots with two fonts.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • Windows (11)

Version since I'm seeing this behavior in Eclipse Committers Version: 2022-03 (4.23.0) Build id: 20220310-1457

Courier_New_font_test Biz_UdGothic_Test [TestRuler.txt](https://github.com/eclipse-platform/eclipse.platform.swt/files/12159223/TestRuler.txt) [biz-udgothic-cufonfonts.zip](https://github.com/eclipse-platform/eclipse.platform.swt/files/12159229/biz-udgothic-cufonfonts.zip)

rushi1698 avatar Jul 25 '23 09:07 rushi1698

Any update on this. Thanks in advance!

rushi1698 avatar Jul 31 '23 04:07 rushi1698

Not able to reproduce in latest version of eclipse (windows 10)

Edit : Able to reproduce in Eclipse SDK (Windows 10)

Version: 2023-09 (4.29) Build id: I20230813-1800

provided performing missing step : Change the font to BIZ UDGothic using Preferences > Colors and Fonts

lathapatil avatar Aug 07 '23 10:08 lathapatil

Hello @lathapatil, Thanks for the update. You mean it is working in the 4.28 version? Currently, as an organisation, we are not able to move to a newer version. We are using the 4.23 version, where this issue still persists. Could you please help me with that, or can you give me the class name where this code change was done for this issue so it will be helpful?

rushi1698 avatar Aug 08 '23 05:08 rushi1698

Hello @lathapatil , I'm able to reproduce the issue in latest version eclipse(4.28).

Eclipse IDE for Eclipse Committers (includes Incubating components)

Version: 2023-06 (4.28.0) Build id: 20230608-1333

Could you please check? Thanks

rushi1698 avatar Aug 08 '23 10:08 rushi1698

Hi @rushi1698 , Even I have checked in the same version of eclipse and downloaded Eclipse IDE for Eclipse Committers . Only difference is Windows version . I am using Windows 10 for testing.

I will try to test it if I can manage to find windows 11 machine.

May be you can debug and check TextEditorDefaultsPreferencePage.java as initial point

Edit : Hello @rushi1698 ,

This issue is reproducible in windows 10 as well . I missed a step here i.e. change the font to BIZ UDGothic using preferences page. May be you can mention this step as well in the steps to reproduce.

lathapatil avatar Aug 08 '23 11:08 lathapatil

I can reproduce this in Eclipse 4.28 with Windows 11.

(I don't know how to fix it, maybe something to do with calculating text metrics)

Phillipus avatar Aug 09 '23 07:08 Phillipus

@Phillipus Thanks for confirming. @lathapatil I tried on Windows 10 with the latest version of Eclipse, but the issue is still the same.

This is not only with specific fonts. If the font is changed to a different one, again the margin line shows on a different column.

rushi1698 avatar Aug 09 '23 09:08 rushi1698

This is not only with specific fonts. If the font is changed to a different one, again the margin line shows on a different column.

Can confirm this happening with several Windows fonts - Verdana, Arial, Calibri, for example.

Edit: and also happening on Mac.

Phillipus avatar Aug 09 '23 09:08 Phillipus

I'm still seeing this on Windows using Eclipse 4.31RC2. Using the default Text Font: Consolas 10, and Print margin: 80

Consolas 9 ❌ Consolas 10 ❌ Consolas 11 ✔ Consolas 12 ✔
Consolas-9 Consolas-10 Consolas-11 Consolas-12

Other fonts:

Courier New 9 ✔ Courier New 10 ✔ Courier New 11 ❌ Courier New 12 ❌
Courier New-9 Courier New-10 Courier New-11 Courier New-12
Cascadia Mono 9 ✔ Cascadia Mono 10 ✔ Cascadia Mono 11 ❌ Cascadia Mono 12 ❌
Cascadia Mono-9 Cascadia Mono-10 Cascadia Mono-11 Cascadia Mono-12

stanio avatar Mar 05 '24 07:03 stanio

I have been able to locate where the margin calculation is taking place,

from SourceViewerDecorationSupport to MarginPainter.

However, I am struggling to comprehend the further debug information regarding retrieving font information from the operating system and calculating the necessary pixels for the given margin.

It seems like every debug detail is presented solely in numerical form. Could someone offer assistance on how to debug this issue further ?

lathapatil avatar Mar 08 '24 09:03 lathapatil