Recent

Author Topic: TLEDNumber Industrialstuff: why it is displaying funny and weird characters?  (Read 941 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 470
  • Programming is FUN only when it works :)
    • Cool Technology
I recently installed my latest and greatest Linux operating system and started to test run my program that uses TLEDNumber control on a form. While testing my program, I noticed that it was displaying funny and weird characters along with my texts and numbers. I am assuming this has to do with character set, but how do I know what character sets are available and which one to choose that only has characters that conforms to US English characters that doesn't include characters from Saudi Arabia or Japan.

Thank you in advance.


wp

  • Hero Member
  • *****
  • Posts: 12754
Please post a small project demonstrating the issue.

paule32

  • Sr. Member
  • ****
  • Posts: 376
this is a typicall problem with (A)nsi and (W)ide String Member Functioions - like you know the so called A and W Function's.
E.g. MessageBoxA(0, L'test', L'test', 0);  // result in 0-String (no text display)
E.g. MessageBoxW(0, 'test', 'test', 0);  // result in Japanese Strings

MessageBoxA(0, PChar('test'), PChar('test'), 0);  // result is Ok - test will display.
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

wp

  • Hero Member
  • *****
  • Posts: 12754
this is a typicall problem with (A)nsi and (W)ide String Member Functioions - like you know the so called A and W Function's.
E.g. MessageBoxA(0, L'test', L'test', 0);  // result in 0-String (no text display)
E.g. MessageBoxW(0, 'test', 'test', 0);  // result in Japanese Strings

MessageBoxA(0, PChar('test'), PChar('test'), 0);  // result is Ok - test will display.
The TS is talking about the TLEDNumber component, not about general text functions. I looked into the sources again: TLEDNumber supports only ASCII characters 42..58,60,62,65..90,92,97..122. I cannot imagine how it can display "Arabian" or "Japanese" characters - that's why I need a demo project.
« Last Edit: April 14, 2025, 07:07:51 pm by wp »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1265
The TS is talking about the TLEDNumber component, not general text functions. I looked into the sources again: TLEDNumber supports only ASCII characters 42..58,60,62,65..90,92,97..122. I cannot imagine how it can display "Arabian" or "Japanese" characters - that's why I need a demo project.
Hello,
Yes , with the 14 segments for each character, it will be hard to display arabian or Japanese characters.

Try TLCDDisplay component but you must define all your non ascii characters.

Friendly, J.P
« Last Edit: April 14, 2025, 06:39:32 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 470
  • Programming is FUN only when it works :)
    • Cool Technology
sorry for not getting back ASAP.

Have a look at the image I attached to this post. This is after I made the change with the following line of code in the FormCreate event. Before that it was really bad; Letters looked weird foreign characters...

Code: Pascal  [Select][+][-]
  1. LEDNumber1.Font.CharSet:=1

Red arrows suppose to be pointing at COLON ( : ), but it obviously doesn't look like one.
« Last Edit: April 14, 2025, 08:41:49 pm by Awesome Programmer »

wp

  • Hero Member
  • *****
  • Posts: 12754
The Font is just inherited from the ancestor TGraphicControl and not used anywhere withing the TLEDNumber component (just for getting the pixel density of the monitor). Could it be that your project has some kind of memory issue? Accessing non-allocated memory? Overwriting "foreign" memory? Does the same issue happen when you drop a TLEDNumber onto a blank form of a new project? There is definitely no problem here for this case.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1265
I have had some weird characters in Edit Mode on Windows with a scale factor of 125% (Attachment 1) for the screen but good in Running Mode. Always good with a scale factor of 100% . And it is always good with the TLCDDisplay component.
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

wp

  • Hero Member
  • *****
  • Posts: 12754
What exactly are you doing? Create and save the project with the TLEDNumber at 96 ppi, and then open it at 120ppi where you see the artefacts? Or do you create the project with TLEDNumber at 120 ppi and see the artefacts immediately? (I don't see them this way)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 470
  • Programming is FUN only when it works :)
    • Cool Technology
I have had some weird characters in Edit Mode on Windows with a scale factor of 125% (Attachment 1) for the screen but good in Running Mode. Always good with a scale factor of 100% . And it is always good with the TLCDDisplay component.

I know this is going to sound stupid, but how do you set scale factors for a winform on Lazarus for Linux Operating System? :)
« Last Edit: April 15, 2025, 07:47:08 pm by Awesome Programmer »

wp

  • Hero Member
  • *****
  • Posts: 12754
I have had some weird characters in Edit Mode on Windows with a scale factor of 125%
Finally I was able to reproduce this. It happened in HiDPI mode for the smallest letter size (2) where an antialiasing method using a double-sized buffer bitmap is applied to improve image quality - but the buffer bitmap was erased only in the original size. The imporant step to trigger the issue was to edit the Caption at design or runtime (I misunderstood the "Edit Mode on Windows").

In this context, I fixed also some more bugs: in case of displayed borders the antialiasing was ignored, borders themselves were not drawn correctly, and the display did not update automatically when the Caption was changed. --> r9727 in CCR.
« Last Edit: April 16, 2025, 12:54:35 am by wp »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1265
I have had some weird characters in Edit Mode on Windows with a scale factor of 125%
Finally I was able to reproduce this. It happened in HiDPI mode for the smallest letter size (2) where an antialiasing method using a double-sized buffer bitmap is applied to improve image quality - but the buffer bitmap was erased only in the original size. The imporant step to trigger the issue was to edit the Caption at design or runtime (I misunderstood the "Edit Mode on Windows").
In this context, I fixed also some more bugs: in case of displayed borders the antialiasing was ignored, borders themselves were not drawn correctly, and the display did not update automatically when the Caption was changed. --> r9727 in CCR.
Hello,
sorry for the "Edit Mode". I have tried your new version of the lednumber.pas file. It seems OK now.

Lazarus 3.6 64 Bits windows 11  Scale factor : 125 %

In attachments before and after the new LedNumber.pas.

Friendly, J.P
« Last Edit: April 16, 2025, 07:18:11 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 470
  • Programming is FUN only when it works :)
    • Cool Technology
I have had some weird characters in Edit Mode on Windows with a scale factor of 125%
Finally I was able to reproduce this. It happened in HiDPI mode for the smallest letter size (2) where an antialiasing method using a double-sized buffer bitmap is applied to improve image quality - but the buffer bitmap was erased only in the original size. The imporant step to trigger the issue was to edit the Caption at design or runtime (I misunderstood the "Edit Mode on Windows").

In this context, I fixed also some more bugs: in case of displayed borders the antialiasing was ignored, borders themselves were not drawn correctly, and the display did not update automatically when the Caption was changed. --> r9727 in CCR.

Awesome. Thank you, wp.

Does this mean I have to download the updated industrialstuff component and install it NOT from online package manager?

Thank you fellows for your replies.

NEVER MIND FOUND IT....
« Last Edit: April 16, 2025, 07:10:13 pm by Awesome Programmer »

wp

  • Hero Member
  • *****
  • Posts: 12754
Yes, you must download from CCR (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/industrialstuff/). Since it's always some work to prepare a release package I usually do not update OPM after each commit to CCR.

 

TinyPortal © 2005-2018