Recent

Author Topic: TAChart demo nogui does not output text  (Read 4940 times)

MaartenJB

  • Full Member
  • ***
  • Posts: 112
TAChart demo nogui does not output text
« on: September 15, 2021, 11:25:34 am »
Hi, I'm trying out the nogui tachart demo, this does output an image, only it's without text. The output looks like the attached picture.

Demo location: C:\lazarus\components\tachart\demo\nogui

I've done a clean installation of the latest version of lazarus.
I've downloaded the freetype.dll and freetype.lib from this site, and put it in the executable folder. ( https://github.com/ubawurinna/freetype-windows-binaries/tree/master/release%20dll/win64 )

I've also tested this in Debian with the same result, I'm trying to figure this out for days, but I'm not able to get it to work.

wp

  • Hero Member
  • *****
  • Posts: 11833
Re: TAChart demo nogui does not output text
« Reply #1 on: September 15, 2021, 12:17:57 pm »
I know...

Checking various Laz versions, I see that the issue came in between Laz 2.0.8/FPC 3.0.4 and Laz 2.0.10/FPC3.2. I am still investigating. It looks as if some scaling factor for the text is missing somewhere. I am also looking at the freetype font handling in FPC which saw some changes but they should have made it into 3.2.0, and stand-alone text output using ftFont (e.g. fpc/.../fcl-image/examples/textout.pp) is correct.

wp

  • Hero Member
  • *****
  • Posts: 11833
Re: TAChart demo nogui does not output text
« Reply #2 on: September 16, 2021, 12:57:16 am »
Please check out the new revision from Lazarus-main. I could find some issues in the TADrawerFPCanvas unit, and I think there were also some issues in the FCL-Image Freetype units which, however, seem to have been fixed at some point in the near past - I did not try to go through the steps through finding the correct FPC revision.

For me, the nogui demo runs fine with the new Laz main in combination with FPC-main or FPC-fixes. The combination with FPC 3.2.2 or 3.2.0 still has the missing texts (probably because the FreeType fix came after the release of FPC 3.2.2). This is for windows; but on Linux the texts do show up also with FPC 3.2.2 - I don't understand why this happens... I did not check cocoa because I did not yet switch to the git version of Laz there.

There is a new procedure, InitFonts, which sets the search path for the FTFont FontMgr to the standard font directories for Linux and mac. Call this very early in your program and you will not have to specify fonts names with path any more.

MaartenJB

  • Full Member
  • ***
  • Posts: 112
Re: TAChart demo nogui does not output text
« Reply #3 on: September 16, 2021, 10:40:52 am »
I've tested it with Lazarus RC1 on Windows and Linux, both didn't show text for me. (Windows you already said it wouldn't)

lazarus-project/now 2.2.0RC1 amd64 [installed,local]
fpc-laz/now 3.2.2 amd64 [installed,local]
fpc-src/now 3.2.2 amd64 [installed,local]


wp

  • Hero Member
  • *****
  • Posts: 11833
Re: TAChart demo nogui does not output text
« Reply #4 on: September 16, 2021, 11:03:15 am »
I've tested it with Lazarus RC1
The fix is not in RC1, but in only "main" (what used to be trunk in the pre-git days); when it is confirmed to work I'll put it into "fixes_2_2" as well.

MaartenJB

  • Full Member
  • ***
  • Posts: 112
Re: TAChart demo nogui does not output text
« Reply #5 on: September 16, 2021, 11:44:52 am »
Is there an official git repository? I thought everything was still on subversion.

wp

  • Hero Member
  • *****
  • Posts: 11833
Re: TAChart demo nogui does not output text
« Reply #6 on: September 16, 2021, 11:54:05 am »
https://gitlab.com/freepascal.org/lazarus/lazarus

Search the forum - there were numerous discussions related to the svn-to-git transition which occured a few weeks ago.

MaartenJB

  • Full Member
  • ***
  • Posts: 112
Re: TAChart demo nogui does not output text
« Reply #7 on: September 16, 2021, 12:06:35 pm »
Ah, nice, thx. I checked the wiki page...

MaartenJB

  • Full Member
  • ***
  • Posts: 112
Re: TAChart demo nogui does not output text
« Reply #8 on: September 28, 2021, 02:49:03 pm »

Which version do I need to try to get it to work?

I've just tried the nogui demo with Lazarus 2.2.0RC2(fixes) / FPC 3.2.3(trunk) and this didn't produce any text. The trunk version of Lazarus made the demo hang on chart.Draw.

wp

  • Hero Member
  • *****
  • Posts: 11833
Re: TAChart demo nogui does not output text
« Reply #9 on: September 28, 2021, 03:06:40 pm »
The fix is in Lazarus trunk (or, as it is named now: main), not yet in fixes_2_2 because I want confirmation by somebody else before I cherry-pick it to fixes. But note that it requires FPC-trunk or FPC-fixes - FPC 3.2.2 or earlier will still prevent the text from showing, at least on Windows.

Please re-read my reply #2.

MaartenJB

  • Full Member
  • ***
  • Posts: 112
Re: TAChart demo nogui does not output text
« Reply #10 on: September 28, 2021, 03:25:58 pm »
aah, you changed the demo as well. now it works. Thanks! I do still need to specify the location of the fonts.



wp

  • Hero Member
  • *****
  • Posts: 11833
Re: TAChart demo nogui does not output text
« Reply #11 on: September 28, 2021, 03:41:05 pm »
I do still need to specify the location of the fonts.
Is this the demo which comes with Lazarus-main? It should call the new procedure InitFonts as first instruction; it tells the FreeType Font Manager the common locations of the fonts.

MaartenJB

  • Full Member
  • ***
  • Posts: 112
Re: TAChart demo nogui does not output text
« Reply #12 on: September 28, 2021, 04:01:22 pm »
yes it's the demo from lazarus-main, and it's the first call the application does.
« Last Edit: September 28, 2021, 04:06:16 pm by MaartenJB »

wp

  • Hero Member
  • *****
  • Posts: 11833
Re: TAChart demo nogui does not output text
« Reply #13 on: September 28, 2021, 04:13:05 pm »
Then I don't understand what you want to say with "I do still need to specify the location of the fonts". Is there an error "Font not found" or so when you run the unmodified nogui demo? Or what is the problem?

MaartenJB

  • Full Member
  • ***
  • Posts: 112
Re: TAChart demo nogui does not output text
« Reply #14 on: September 28, 2021, 04:19:50 pm »
yes, and I'd attached the error in my previous post (third image)

I mean, I still have to specify the full path instead of the filename only.

Generates error from above
Code: Pascal  [Select][+][-]
  1.   FONT_NAME = 'LiberationSans-Regular.ttf';

Works
Code: Pascal  [Select][+][-]
  1.   FONT_NAME = '/usr/share/fonts/truetype/liberation2/LiberationSans-Regular.ttf';
« Last Edit: September 28, 2021, 04:29:31 pm by MaartenJB »

 

TinyPortal © 2005-2018