Re: [fpc-pascal] bug in make install ?

2019-03-19 Thread Joost van der Sluis

On 3/19/19 2:06 PM, Joost van der Sluis wrote:

On 3/19/19 11:35 AM, Mattias Gaertner via fpc-pascal wrote:

On Tue, 19 Mar 2019 11:17:42 +0100
Joost van der Sluis  wrote:


[...]

Probably it fails because I have old 2.6.4 fppkg configs.


I ran the samplecfg, which said it would create ~/.fpc.cfg, ~/.fp, ...
Then the error was gone.

I restored the files from backup. Initial dialog pops up with error.
But to my surprise the create config button worked.
So apparently samplecfg changes more files than it claims.
I have to find out what it does.


This was useful information. I have the same error-message now.

Do you also have something like this in your fppkg.cfg? (The one that 
fails)


Path=/home/CNOC/joost/fpc/lib/fpc/{CompilerVersion}//{CompilerVersion}/

(Note the duplicate {CompilerVersion} ?)

Not so easy to solve, though. I can imagine that some people do have FPC 
installed in a directory that does not contain the compiler-version. So 
I'll have to adapt fpcmkcfg...


On a second look it seems that this problem has been resolved already. 
Did you have an old version of fpcmkcfg, maybe?


I'll add a check for that.

Regards,

Joost.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-19 Thread LacaK



Is there way how to get correct PDF file WITHOUT embedding full 
Courier font?


You can embed only the needed characters for every font ?
Probably yes, but fpPDF will not handle this automatically? AFAIK I 
can not control this.


But why I get unreadable characters? What I am doing wrong ?


It seems that there is problem specific to CourierNew font (cour.ttf).
With Arial (arial.ttf) it works as expected.

Attached program which demonstrates problem.

-Laco.

unit test_fpPDF1;

{$mode objfpc}{$H+}
{$codepage UTF8}


interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
Edit1: TEdit;
procedure FormShow(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

uses fpPDF;

{ TForm1 }

procedure TForm1.FormShow(Sender: TObject);
var
  PDF: TPDFDocument;
  Font1, Font2: integer;
begin
  PDF := TPDFDocument.Create(Self);
  PDF.Infos.Producer := '';
  PDF.Infos.CreationDate := Now;
  PDF.Options := [poPageOriginAtTop, {poNoEmbeddedFonts,} poSubsetFont, 
poCompressFonts, poCompressImages];
  PDF.DefaultOrientation := ppoPortrait;
  PDF.DefaultPaperType := ptA4;
  PDF.DefaultUnitOfMeasure := uomMillimeters;
  PDF.FontDirectory := 'C:\WINDOWS\FONTS';
  PDF.StartDocument;
  PDF.Sections.AddSection;
  PDF.Sections[0].AddPage(PDF.Pages.AddPage);;

  //FontIndex := PDF.AddFont('Courier');
  Font1 := PDF.AddFont('cour.ttf', 'CourierNew');
  Font2 := PDF.AddFont('arial.ttf', 'Arial');
  PDF.Pages[0].SetFont(Font1, 10);
  PDF.Pages[0].WriteText(10,10,'AEIOU-ÁÉÍÓÚ-ČŠŇŽ');
  PDF.Pages[0].WriteText(10,15,'');
  PDF.Pages[0].WriteText(10,20,Edit1.Text);

  PDF.Pages[0].SetFont(Font2, 10);
  PDF.Pages[0].WriteText(10,30,'AEIOU-ÁÉÍÓÚ-ČŠŇŽ');
  PDF.Pages[0].WriteText(10,35,'');

  PDF.SaveToFile('test.pdf');
end;

end.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] bug in make install ?

2019-03-19 Thread Joost van der Sluis

On 3/19/19 11:35 AM, Mattias Gaertner via fpc-pascal wrote:

On Tue, 19 Mar 2019 11:17:42 +0100
Joost van der Sluis  wrote:


[...]

Probably it fails because I have old 2.6.4 fppkg configs.


I ran the samplecfg, which said it would create ~/.fpc.cfg, ~/.fp, ...
Then the error was gone.

I restored the files from backup. Initial dialog pops up with error.
But to my surprise the create config button worked.
So apparently samplecfg changes more files than it claims.
I have to find out what it does.


This was useful information. I have the same error-message now.

Do you also have something like this in your fppkg.cfg? (The one that fails)

Path=/home/CNOC/joost/fpc/lib/fpc/{CompilerVersion}//{CompilerVersion}/

(Note the duplicate {CompilerVersion} ?)

Not so easy to solve, though. I can imagine that some people do have FPC 
installed in a directory that does not contain the compiler-version. So 
I'll have to adapt fpcmkcfg...


Regards,

Joost.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-19 Thread LacaK





Hi,

I am trying work with fpPDF. I can create PDF document, but character 
out of ASCII range are displayed wrong (in PDF file they are stored 
as UTF8).
Probably it is because I use standard Courier font, which is 
expecting only "Latin characters" ? I use:


FontIndex := PDF.AddFont('Courier'); // --> test1.pdf

When I want to use TTF font:

FontIndex := PDF.AddFont('cour.ttf','CourierNew');  // --> test2.pdf
(nothing else this line has changed)

I get strange PDF file (I can open it but content is wrong)

What I am doing wrong? Is there way how to get correct PDF with 
characters from Latin2 code page?


Not to my knowledge. You must use unicode for characters outside the 
ASCII range.


Seems, that Adobe in 
https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf 
in Annex D2: "Latin Character Set and Encodings" specifies exactly which 
characters are supported (by standard 14 fonts). Characters not listed 
there are simply replaced by "X" in Adobe Acrobat Reader. But Foxit 
reader displays them correctly (so I can use full range of characters 
from CP1250 when I specify appropriate 

Re: [fpc-pascal] bug in make install ?

2019-03-19 Thread Mattias Gaertner via fpc-pascal
On Tue, 19 Mar 2019 11:17:42 +0100
Joost van der Sluis  wrote:

>[...]
> > Probably it fails because I have old 2.6.4 fppkg configs.  

I ran the samplecfg, which said it would create ~/.fpc.cfg, ~/.fp, ...
Then the error was gone.

I restored the files from backup. Initial dialog pops up with error.
But to my surprise the create config button worked.
So apparently samplecfg changes more files than it claims.
I have to find out what it does.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] bug in make install ?

2019-03-19 Thread Joost van der Sluis

On 3/18/19 11:21 PM, Mattias Gaertner via fpc-pascal wrote:

On Mon, 18 Mar 2019 22:04:17 +0100
Joost van der Sluis  wrote:



Definitely.
It would be even better to tell the full file name.
e.g. /etc/fpcpkg.cfg.



Problem is that it could also be in the fppkg-compiler configuration
file (by default called default). But it could also be something
else. To be honest, I don't have a clue why it does not work for you.


That's my problem too. That's why I'm asking for a better error message.


I can not give a better error-message, if I do not even know myself what 
the problem of your configuration is.



One guess would be that you do not have the fpmkunit-directory
available.


It would be extremely helpful, if it would check common mistakes, like
this. An error message "Directory /path/fpmkunit is missing. Check your
/etc/fpcpkg.cfg." would be far better than "Error: the Fppkg
configuration is corrupt."
What is corrupt? Is something missing, too much, not readable, did a
command fail? What did it check to come to this conclusion?


It already does all checks I can think of. And it does have special 
messages for all those cases.


But, as long as I do not know what the problem is that you or others are 
experiencing, I can not give a better message.


The message you see is the last message, when it failes but the system 
has no clue why.


Maybe I should change this message to what is exactly happens, that it 
can not find the rtl. But this was the message in the past, leading to 
all kind of complains like: 'But the RTL is just there!'.


We have to find the right message. It also took a while until we found 
the right text for the other problems in this dialog.


But first I have to know what your issue actually is.


Does not work. Can you elaborate, what it should do?


Call samplecfg. ;)

The dialog checks if the given prefix is valid. (It checks for the
existence of a few files)


Lazarus does similar checks with fpc. Some fpc version changed some
paths, some platforms have different files. Boom, the user gets a
wrong error message. That's why the IDE should tell exactly, what it
checked.


When it can not find those files, it will tell you so. Just like the 
other screens do. Just type something on the combobox with the prefix, 
it will give you hints until the path is probably right.
  

When you click on the button to create the new configuration-file, it
calls 'fpcmkcfg -3' and 'fpcmkcfg -4' with the parameters deducted
from the given prefix. Just like samplecfg on Linux does.

After this, it re-loads fppkg. And it checks if the rtl-package can
be found. If this is not the case, it complains.

So, can you give the output of 'fppkg listsettings' and 'fppkg list
-d', to check why it can not find the rtl?


Probably it fails because I have old 2.6.4 fppkg configs.


It should be able to handle those. And even when not, fpcmkcfg should 
just overwrite those.


Another guess would be: it uses an old version of fpcmkcfg. Older 
versions need other parameters for it to work. But it seaches for 
fpcmkcfg at the same location it finds the compiler. So when you did do 
a 'make install', it should use the latest version.


How do your fppkg.cfg and default files looks like? After the re-create 
that is?


Regards,

Joost.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpPDF and support of Latin2 charset

2019-03-19 Thread Michael Van Canneyt



On Tue, 19 Mar 2019, LacaK wrote:


Hi,

I am trying work with fpPDF. I can create PDF document, but character out of 
ASCII range are displayed wrong (in PDF file they are stored as UTF8).
Probably it is because I use standard Courier font, which is expecting only 
"Latin characters" ? I use:


FontIndex := PDF.AddFont('Courier'); // --> test1.pdf

When I want to use TTF font:

FontIndex := PDF.AddFont('cour.ttf','CourierNew');  // --> test2.pdf
(nothing else this line has changed)

I get strange PDF file (I can open it but content is wrong)

What I am doing wrong? Is there way how to get correct PDF with characters 
from Latin2 code page?


Not to my knowledge. 
You must use unicode for characters outside the ASCII range.



Is there way how to get correct PDF file WITHOUT embedding full Courier font?


You can embed only the needed characters for every font ?

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] fpPDF and support of Latin2 charset

2019-03-19 Thread LacaK

Hi,

I am trying work with fpPDF. I can create PDF document, but character 
out of ASCII range are displayed wrong (in PDF file they are stored as 
UTF8).
Probably it is because I use standard Courier font, which is expecting 
only "Latin characters" ? I use:


FontIndex := PDF.AddFont('Courier'); // --> test1.pdf

When I want to use TTF font:

FontIndex := PDF.AddFont('cour.ttf','CourierNew');  // --> test2.pdf
(nothing else this line has changed)

I get strange PDF file (I can open it but content is wrong)

What I am doing wrong? Is there way how to get correct PDF with 
characters from Latin2 code page?
Is there way how to get correct PDF file WITHOUT embedding full Courier 
font?


Thanks

-Laco.

Full source code is:

var
  PDF: TPDFDocument;
  FontIndex: integer;
begin
  PDF := TPDFDocument.Create(Self);
  PDF.Infos.Producer := '';
  PDF.Infos.CreationDate := Now;
  PDF.Options := [poPageOriginAtTop, {poNoEmbeddedFonts,} poSubsetFont, 
poCompressFonts, poCompressImages];

  PDF.DefaultOrientation := ppoPortrait;
  PDF.DefaultPaperType := ptA4;
  PDF.DefaultUnitOfMeasure := uomMillimeters;
  PDF.FontDirectory := 'C:\WINDOWS\FONTS';
  PDF.StartDocument;
  PDF.Sections.AddSection;
  PDF.Sections[0].AddPage(PDF.Pages.AddPage);;

  //FontIndex := PDF.AddFont('Courier');
  FontIndex := PDF.AddFont('cour.ttf', 'CourierNew');
  PDF.Pages[0].SetFont(FontIndex, 10);
  PDF.Pages[0].WriteText(10,10,'AEIOU-ÁÉÍÓÚ-ČŠŇŽ');
  PDF.Pages[0].WriteText(10,15,'');
  PDF.Pages[0].WriteText(10,20,'AEIOU-ÁÉÍÓÚ-ČŠŇŽ');

  PDF.SaveToFile('test.pdf');
end;



test1.pdf
Description: Adobe PDF document


test2.pdf
Description: Adobe PDF document
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal