Recent

Author Topic: [Solved] Letters chopped off in highlights of code tools.  (Read 1639 times)

jamie

  • Hero Member
  • *****
  • Posts: 6090
[Solved] Letters chopped off in highlights of code tools.
« on: May 31, 2023, 11:00:49 pm »
has anyone noticed if you use the code tools to show the inners of a unit specifying a letter to show the letter you specified gets colored but I noticed it does not always fully draw without the following letter overlapping it.

For example, somewhere in the text editor type.

System.O  and wait.

you will see the list of entries with O's color red in my IDE, scroll down and notice how some of them get chopped a little and looks like a letter C instead.

This is on Windows 10, if that matters, and it seems like it's been around for a while.
« Last Edit: June 02, 2023, 01:16:19 pm by jamie »
The only true wisdom is knowing you know nothing

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: Letters chopped off in highlights of code tools.
« Reply #1 on: June 01, 2023, 01:07:14 am »
has anyone noticed if you use the code tools to show the inners of a unit specifying a letter to show the letter you specified gets colored but I noticed it does not always fully draw without the following letter overlapping it.

For example, somewhere in the text editor type.

System.O  and wait.

you will see the list of entries with O's color red in my IDE, scroll down and notice how some of them get chopped a little and looks like a letter C instead.

This is on Windows 10, if that matters, and it seems like it's been around for a while.

I cannot reproduce using 2.2.4, 2.2.6, or 2.3.0. I tried it on Win 8.1 and Win 11. I don't have access to Win 10 ATM. I tried various fonts in the editors.  Which font are you using?

In any case, I cannot reproduce. My code tools pop-ups look correct.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Letters chopped off in highlights of code tools.
« Reply #2 on: June 01, 2023, 01:24:44 am »
Ok, lets see if I can insert an image.
The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Letters chopped off in highlights of code tools.
« Reply #3 on: June 01, 2023, 01:37:25 am »
What font and size have you setup?

I think I can see it on my system, just missing a single line of a pixel an M or W. Compared to how they look in the editor.


jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Letters chopped off in highlights of code tools.
« Reply #4 on: June 01, 2023, 01:53:05 am »
The only info I can find in the options for Font and size is the editor and that is Size 10 Courier New.

is that what you are looking for?

I use a default install, I have never changed those settings.

I have 96 PPI/100% 1920x1080 on a 24 inch monitor.
The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Letters chopped off in highlights of code tools.
« Reply #5 on: June 01, 2023, 02:05:21 am »
Ok, with courier it is more noticeable.

The next letter is one pixel to far left.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Letters chopped off in highlights of code tools.
« Reply #6 on: June 01, 2023, 02:12:20 am »
maybe a ROUND should be used instead of a trunk  :o
The only true wisdom is knowing you know nothing

cdbc

  • Hero Member
  • *****
  • Posts: 1026
    • http://www.cdbc.dk
Re: Letters chopped off in highlights of code tools.
« Reply #7 on: June 01, 2023, 07:48:46 am »
Hi
@jamie: Qt 5.6 on PCLinuxOS does it too, seems to me, when bolded.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Letters chopped off in highlights of code tools.
« Reply #8 on: June 01, 2023, 02:23:33 pm »
Well, it's always good to see widget compatibility is well supported!  :D
The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Letters chopped off in highlights of code tools.
« Reply #9 on: June 01, 2023, 02:30:35 pm »
Should be reported as bug

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Letters chopped off in highlights of code tools.
« Reply #10 on: June 01, 2023, 02:48:07 pm »
You also may try the following path
Code: Diff  [Select][+][-]
  1. diff --git a/ide/sourceeditprocs.pas b/ide/sourceeditprocs.pas
  2. index 209d2dc061..e58a18b1b8 100644
  3. --- a/ide/sourceeditprocs.pas
  4. +++ b/ide/sourceeditprocs.pas
  5. @@ -38,7 +38,7 @@ interface
  6.  uses
  7.    Classes, SysUtils, RegExpr,
  8.    // LCL
  9. -  LCLType, Graphics, Controls,
  10. +  LCLType, Graphics, Controls, LCLIntf,
  11.    // LazUtils
  12.    LazFileUtils, LazStringUtils,
  13.    // SynEdit
  14. @@ -303,6 +303,7 @@ function PaintCompletionItem(const AKey: string; ACanvas: TCanvas; X, Y,
  15.    HintModifier: TPascalHintModifier;
  16.    HelperForNode: TCodeTreeNode;
  17.  begin
  18. +  SetBkMode(ACanvas.Handle, TRANSPARENT);
  19.    if Colors<>nil then
  20.    begin
  21.      if ItemSelected then
  22.  

Not sure, if it is an issue in Canvas.TextOut itself or what it is....

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Letters chopped off in highlights of code tools.
« Reply #11 on: June 01, 2023, 06:43:46 pm »
I believe it's what as stated, BOLD is producing a wider image and it needs to be adjusted one pixel.

I don't see what you did would help?

But then again, I am getting old and comes with that is confusion!  :-[
The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Letters chopped off in highlights of code tools.
« Reply #12 on: June 01, 2023, 07:43:07 pm »
Well, as I said, on my IDE there was one pixel missing too. (Usually just filled with some anti aliased pixels, so not easy to spot, but missing).

With the patch, on my Setup the Pixel was there.

Did you apply the patch and test?

paweld

  • Hero Member
  • *****
  • Posts: 970
Re: Letters chopped off in highlights of code tools.
« Reply #13 on: June 02, 2023, 10:56:05 am »
Martin - thank you, your patch solved problem.
Lazarus 2.3 trunk, font "Consolas"
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Letters chopped off in highlights of code tools.
« Reply #14 on: June 02, 2023, 11:51:20 am »
And here is an image with the Courier font (as in the original report).

The image is heavily magnified. It contains the same word in
- source edit - non bold
- source edit - bold (as comment)
- non-fixed: completion
- fixed: completion

The spacing is the same in all of them. All letters -across all lines - start in the same pixel column. Every 8 pixel.

It is just that the "b", even though it is on the correct position paints into the space of the "O". And yes, proportional fonts do that nowadays.
If it is painted in one swoop, there is no problem. But if it is painted in several pieces, the "b" paints its background over the "O".

 

TinyPortal © 2005-2018