bobbylight / RSyntaxTextArea

A syntax highlighting, code folding text editor for Java Swing applications.
BSD 3-Clause "New" or "Revised" License
1.12k stars 259 forks source link

Display is abnormal in jdk17 #525

Open highgozhangyc opened 11 months ago

highgozhangyc commented 11 months ago

Description In jdk 17, after selecting a string, the characters are displayed on top of the background color, and there is no gap between the characters and the top of the background color. However, in jdk8, there is a gap between the characters and the top of the background color. The problem this brings is that when the characters I use are Chinese, I will find that the selected characters exceed the background color range.

Steps to Reproduce Specific steps to reproduce the behavior:

  1. Use jdk8 to run the demo program, and then enter Chinese in the editor;
  2. Use jdk17 to run the demo program, and then enter the same content as in the first step in the editor;
  3. Observe the gap between the top of the characters and the selected background color when selecting content in the editor in the two scenarios;

Expected behavior In both scenarios, the distance between the top of the selected character and the background color area is the same

Actual behavior In the two scenarios, the gap between the top of the selected character and the selected background color is different. The gap is very small under jdk17, which will cause the selected character to exceed the background color area when the selected content is Chinese.

Screenshots jdk 17: image

jdk8: image

Java version jdk8 & jdk17

Additional context Add any other context about the problem here.

bobbylight commented 4 months ago

@highgozhangyc - can you reproduce this with the newly-released RSTA 3.5.0 or newer? I don't see the text's baseline being so high in my tests, e.g. on Java 17 on Windows with the default RSTA settings:

image