Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2020-07

ftfont and FreeType

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Werner Pamler

I am having issues in the nogui demo of TAChart with FPC 3.2.0. It uses the FCL unit ftfont and crashes at runtime with

    Project noguidemo.exe raised exception class 'EInOutError' with message:
    Can not load Freetype library "freetype.dll". Check your installation.

This does not happen when I compile exactly the same program with FPC 3.0.4

Since I see in the ftfont code the directive {$DEFINE DYNAMIC} I downloaded the freetype.dll from the
https://github.com/ubawurinna/freetype-windows-binaries (recommended by freetype.org) into the exe directory, but it still does not run (same error).

Any idea what I can do to make the program work again? I am on Windows 10.

Reply by email

Ondrej Pokorny
to Werner Pamler

I am not 100% sure, but some freetype.dll versions can depend on zlib1.dll. I.e. you need to copy zlib1.dll to the exe directory as well.

Actually I just found an info about it:
https://wiki.freepascal.org/FPReport_FAQ (see Lazarus does not start anymore in Windows).

Ondrej

Werner Pamler wrote 23 lines
I am having issues in the nogui demo of TAChart with FPC 3.2.0. It uses the FCL unit ftfont and crashes at runtime with     Project noguidemo.exe raised exception class 'EInOutError' with message:     Can not load Freetype library "freetype.dll". Check your installation. This does not happen when I compile exactly the same program with FPC 3.0.4 Since I see in the ftfont code the directive {$DEFINE DYNAMIC} I downloaded the freetype.dll from the https://github.com/ubawurinna/freetype-windows-binaries (recommended by freetype.org) into the exe directory, but it still does not run (same error). Any idea what I can do to make the program work again? I am on Windows 10. _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Werner Pamler
to Ondrej Pokorny
Ondrej Pokorny wrote 6 lines
I am not 100% sure, but some freetype.dll versions can depend on zlib1.dll. I.e. you need to copy zlib1.dll to the exe directory as well. Actually I just found an info about it: https://wiki.freepascal.org/FPReport_FAQ (see Lazarus does not start anymore in Windows).

Thanks Ondrej. But I think I made a stupid mistake and probably had chosen the wrong bitness version from the download site because now the demo is working in both 32 and 64 bit, without zlib1.dll.

I still wonder why the FCL freetype support was changed to require the dll now while it was not in the old FPC version. BTW, this breaking change is not mentioned on the "New Features"
(https://wiki.freepascal.org/FPC_New_Features_3.2.0) nor on the "User Changes" pages (https://wiki.freepascal.org/User_Changes_3.2.0).

Reply by email

Michael Van Canneyt
to Werner Pamler
Werner Pamler wrote 13 lines
Am 17.07.2020 um 12:30 schrieb Ondrej Pokorny: > I am not 100% sure, but some freetype.dll versions can depend on > zlib1.dll. I.e. you need to copy zlib1.dll to the exe directory as well. > > Actually I just found an info about it: > https://wiki.freepascal.org/FPReport_FAQ (see Lazarus does not start > anymore in Windows). Thanks Ondrej. But I think I made a stupid mistake and probably had chosen the wrong bitness version from the download site because now the demo is working in both 32 and 64 bit, without zlib1.dll. I still wonder why the FCL freetype support was changed to require the dll now while it was not in the old FPC version.

It is exactly the opposite.

It can now load the DLL dynamically.

home:~/fpc/packages/fcl-image/src> svn log freetypeh.pp ------------------------------------------------------------------------ r37865 | michael | 2017-12-29 15:22:33 +0100 (Fri, 29 Dec 2017) | 1 line

Dynamic use of freetype lib

You can use unit freetypeh.pp which links statically (as it was) or freetypehdyn.pp which loads dynamically.

fpReport does require the presence of freetype. In order to be able to install it in Lazarus without requiring the presence of a dll, the ability to load freetype dll dynamically was added.

Michael.

Reply by email

Werner Pamler
to Michael Van Canneyt
Michael Van Canneyt wrote 17 lines
It is exactly the opposite. It can now load the DLL dynamically. home:~/fpc/packages/fcl-image/src> svn log freetypeh.pp ------------------------------------------------------------------------ r37865 | michael | 2017-12-29 15:22:33 +0100 (Fri, 29 Dec 2017) | 1 line Dynamic use of freetype lib You can use unit freetypeh.pp which links statically (as it was) or freetypehdyn.pp which loads dynamically. fpReport does require the presence of freetype. In order to be able to install it in Lazarus without requiring the presence of a dll, the ability to load freetype dll dynamically was added.

Please excuse my ignorance: How can I change using freetypeh instead of freetypedyn (which is default and thus breaks existing code)? This is inside ftfont which is out of reach from my Lazarus program. I do not want to force a user of a short demo program to recompile the FCL. Or maybe I am completely lost...

Reply by email

Michael Van Canneyt
to Werner Pamler
Werner Pamler wrote 20 lines
Am 17.07.2020 um 17:26 schrieb Michael Van Canneyt: > It is exactly the opposite. > > It can now load the DLL dynamically. > > home:~/fpc/packages/fcl-image/src> svn log freetypeh.pp > ------------------------------------------------------------------------ > r37865 | michael | 2017-12-29 15:22:33 +0100 (Fri, 29 Dec 2017) | 1 line > > Dynamic use of freetype lib > > You can use unit freetypeh.pp which links statically (as it was) > or freetypehdyn.pp which loads dynamically. > > fpReport does require the presence of freetype. In order to be able to > install it in Lazarus without requiring the presence of a dll, the > ability > to load freetype dll dynamically was added. Please excuse my ignorance: How can I change using freetypeh instead of freetypedyn (which is default and thus breaks existing code)?

First you'll have to explain something:
Why does it break existing code according to you ? The default library name is the same in both units.

Michael.

Reply by email

Werner Pamler
to Michael Van Canneyt
Michael Van Canneyt wrote
First you'll have to explain something: Why does it break existing code according to you ? The default library name is the same in both units.

Compile and run the noguidemo in the Lazarus folder components/tachart/demo/nogui. It creates a chart without a gui and saves it as a png file. Compiling with fpc 3.0.4 this occurs immediately and flawlessly. Compiling with fpc 3.2.0 or fpc trunk, however, there is an error message that the freetype.dll is not found.

So, the changes in ftfont.pp are "breaking", because a program which used to work correctly had stopped working. I do agree, though, that my phrasing "code-breaking" was not correct, strictly speaking, because no changes in code are required to make the program run: the user only must provide the freetype.dll (of the correct bitness).

I do not have a problem with this change when I know that there was good reason behind it and it  was not made by incidence or error (such things happen...). But in any case, a breaking change should be mentioned in the official wiki pages.

Reply by email

Michael Van Canneyt
to Werner Pamler
Werner Pamler wrote 20 lines
Am 17.07.2020 um 23:29 schrieb Michael Van Canneyt via fpc-devel: > First you'll have to explain something: > Why does it break existing code according to you ? > The default library name is the same in both units. Compile and run the noguidemo in the Lazarus folder components/tachart/demo/nogui. It creates a chart without a gui and saves it as a png file. Compiling with fpc 3.0.4 this occurs immediately and flawlessly. Compiling with fpc 3.2.0 or fpc trunk, however, there is an error message that the freetype.dll is not found. So, the changes in ftfont.pp are "breaking", because a program which used to work correctly had stopped working. I do agree, though, that my phrasing "code-breaking" was not correct, strictly speaking, because no changes in code are required to make the program run: the user only must provide the freetype.dll (of the correct bitness). I do not have a problem with this change when I know that there was good reason behind it and it  was not made by incidence or error (such things happen...). But in any case, a breaking change should be mentioned in the official wiki pages.

The name was changed to conform to the names in the releases here: https://github.com/ubawurinna/freetype-windows-binaries/tree/master/win32

For such open-source projects, the lack of unified naming is a problem. To make things worse, the programmer can rename DLLs to avoid conflicts etc.

That's why I believe making the libraries dynamically loadable is a better approach, and as such the default name becomes less important and IMHO is not a 'breaking change'.

But if you think it is, please change the wiki.

Michael.

Reply by email