Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Sven Barth
Am 07.04.2016 14:58 schrieb "Martin Schreiber" : > > On Thursday 07 April 2016 13:49:06 Graeme Geldenhuys wrote: > > I was about to mention that. This was discussed before, and there was a > > reason (which eludes me now) why FillChar() will not be changed. > > Because out parameters are finalised

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Martin Schreiber
On Thursday 07 April 2016 13:49:06 Graeme Geldenhuys wrote: > I was about to mention that. This was discussed before, and there was a > reason (which eludes me now) why FillChar() will not be changed. Because out parameters are finalised on caller side: " Procedure FillChar1(out x;count:SizeInt;V

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Sven Barth
Am 07.04.2016 13:49 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2016-04-07 12:25, Martok wrote: > > If Move+FillChar would use out instead of var (as they should - they don't read > > the dest value, that's the whole point), that would be fixed once and for all. > > But I r

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Graeme Geldenhuys
On 2016-04-07 12:25, Martok wrote: > If Move+FillChar would use out instead of var (as they should - they don't > read > the dest value, that's the whole point), that would be fixed once and for all. > But I remember having this discussion before and apparently it was like this > for > some compa

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Martok
>> You will get the hint here then, no ? > > No. Seems the compiler is more lenient with pointer types. That's a bug then, isn't it? After all, it's about the var parameter, not what is passed into it... The variable that is passed into FillChar is not yet initialized, but it could be read inside

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Graeme Geldenhuys
On 2016-04-07 11:37, Michael Van Canneyt wrote: > You will get the hint here then, no ? No. Seems the compiler is more lenient with pointer types. Regards, - Graeme - -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.la

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Michael Van Canneyt
On Thu, 7 Apr 2016, Graeme Geldenhuys wrote: On 2016-03-31 16:48, silvioprog wrote: +{$IFDEF VER3} + Buffer := Default(TBuffer) +{$ELSE} + FillChar(Buffer,SizeOf(TBuffer),0) +{$ENDIF}; Just thought I would mention, I've seen the above code listed a few times now to remove the fam

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Graeme Geldenhuys
On 2016-03-31 16:48, silvioprog wrote: > +{$IFDEF VER3} > + Buffer := Default(TBuffer) > +{$ELSE} > + FillChar(Buffer,SizeOf(TBuffer),0) > +{$ENDIF}; Just thought I would mention, I've seen the above code listed a few times now to remove the famous "Local variable does not seem to be in

Re: [Lazarus] PDF generator, try 2

2016-04-07 Thread Graeme Geldenhuys
On 2016-04-07 07:36, Michael Van Canneyt wrote: > > This should not exist to begin with, I think. > The UTF8Decode function of the system unit performs the same function. Indeed, you are correct. I'll make the change. Regards, - Graeme - -- ___ L

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Michael Van Canneyt
On Thu, 7 Apr 2016, Sven Barth wrote: the SetMultiByteConversionCodePage(CP_UTF8) call makes DefaultSystemCodePage=CP_UTF8 which matches UTF8String and so in fpc_ansistr_to_ansistr no conversion is performed. And so that is why SetMultiByteConversionCodePage(CP_UTF8) is needed when compil

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Sven Barth
Am 07.04.2016 07:43 schrieb "Jesus Reyes A." : > > En Wed, 06 Apr 2016 13:14:49 -0500, Michael Van Canneyt < mich...@freepascal.org> escribió: > >> >> >> On Wed, 6 Apr 2016, silvioprog wrote: >> >>> On Wed, Apr 6, 2016 at 2:14 PM, Michael Van Canneyt < mich...@freepascal.org> >>> wrote: >>> [...] >

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Jesus Reyes A.
En Wed, 06 Apr 2016 13:14:49 -0500, Michael Van Canneyt escribió: On Wed, 6 Apr 2016, silvioprog wrote: On Wed, Apr 6, 2016 at 2:14 PM, Michael Van Canneyt wrote: [...] Why is this patch needed ? It should not be needed at all ? Sorry, I sent a wrong patch, please consider this ne

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Jesus Reyes A.
On Wed, 06 Apr 2016 12:23:12 -0500, Graeme Geldenhuys wrote: On 2016-04-01 20:16, Jesus Reyes A. wrote: (it seems currently is not necessary because the matrix is auto-adjusted) and then ... P.WriteUTF8Text(15, 120, 'Languages: English: Hello, World!'); P.WriteUTF8Text(40, 130, 'Gre

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Michael Van Canneyt
On Wed, 6 Apr 2016, silvioprog wrote: On Wed, Apr 6, 2016 at 2:14 PM, Michael Van Canneyt wrote: [...] Why is this patch needed ? It should not be needed at all ? Sorry, I sent a wrong patch, please consider this new one in attachment. My patch just fix wrong chars in the generated PDF,

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread silvioprog
On Wed, Apr 6, 2016 at 2:14 PM, Michael Van Canneyt wrote: [...] > Why is this patch needed ? It should not be needed at all ? > Sorry, I sent a wrong patch, please consider this new one in attachment. My patch just fix wrong chars in the generated PDF, eg, before the apply it, I got: ... Engl

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Graeme Geldenhuys
On 2016-04-01 02:21, Jesus Reyes A. wrote: >> > // Add your custom page as follows >> > P := TMyPDFPage.Create(Doc); >> > Doc.Pages.Add(P); // global Page Object list >> > lSection.AddPage(P); // which Section our page belongs too >> > > Yes that would suffice, thanks. This change has now

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Graeme Geldenhuys
On 2016-04-06 18:23, Michael Van Canneyt wrote: > Patch applied. Rev. 33428. Thanks Michael. Regards, - Graeme - -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Graeme Geldenhuys
On 2016-04-06 18:18, Michael Van Canneyt wrote: >>> >> procedure CreateTTFCIDSystemInfo(const {%H-}EmbeddedFontNum: >>> >> integer;{%H-}FontDef: TFontDef);virtual; >>> >> >> > >> > {$HINTS OFF} instead of it? > No, fix the hint (if possible). > As I "hinted" (excuse the pun) at before, any refere

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Michael Van Canneyt
On Wed, 6 Apr 2016, Graeme Geldenhuys wrote: On 2016-04-06 17:57, silvioprog wrote: This attached patch definitely fixes this error on Windows. :-) This was already fixed (plus other changes). I simply forgot to send Michael the email yesterday to update FPC. Patch applied. Rev. 33428. M

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Graeme Geldenhuys
On 2016-04-01 20:16, Jesus Reyes A. wrote: > (it seems currently is not necessary because the matrix is auto-adjusted) > and then ... > >P.WriteUTF8Text(15, 120, 'Languages: English: Hello, World!'); >P.WriteUTF8Text(40, 130, 'Greek: -FÃåéÜ óïõ êüóìïò'); >P.WriteUTF8Text(40, 140, 'P

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Michael Van Canneyt
On Wed, 6 Apr 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 1:17 PM, Michael Van Canneyt wrote: [...] Please, don't do {%H-} etc: procedure CreateTTFCIDSystemInfo(const {%H-}EmbeddedFontNum: integer;{%H-}FontDef: TFontDef);virtual; {$HINTS OFF} instead of it? No, fix the hint (if p

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Graeme Geldenhuys
On 2016-04-06 17:57, silvioprog wrote: > This attached patch definitely fixes this error on Windows. :-) This was already fixed (plus other changes). I simply forgot to send Michael the email yesterday to update FPC. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Fr

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Michael Van Canneyt
On Wed, 6 Apr 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 1:13 PM, Michael Van Canneyt wrote: On Thu, Mar 31, 2016 at 11:18 AM, silvioprog wrote: [...] Greek: Ge?? s?? ??s Polish: Witaj swiecie Portuguese: Ol? mundo Russian: ??? Vietnamese: Xin ch?o th? gi?i This a

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread silvioprog
On Wed, Apr 6, 2016 at 1:57 PM, silvioprog wrote: > On Thu, Mar 31, 2016 at 1:13 PM, Michael Van Canneyt < > mich...@freepascal.org> wrote: >> >> On Thu, Mar 31, 2016 at 11:18 AM, silvioprog >>> wrote: >> >> [...] > >> Greek: Ge?? s?? ??s >>> Polish: Witaj swiecie >>> Portuguese: Ol? mundo >>> R

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread silvioprog
On Thu, Mar 31, 2016 at 1:13 PM, Michael Van Canneyt wrote: > > On Thu, Mar 31, 2016 at 11:18 AM, silvioprog wrote: > > [...] > Greek: Ge?? s?? ??s >> Polish: Witaj swiecie >> Portuguese: Ol? mundo >> Russian: ??? >> Vietnamese: Xin ch?o th? gi?i > > This attached patch definitely f

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread silvioprog
On Thu, Mar 31, 2016 at 1:17 PM, Michael Van Canneyt wrote: [...] > Please, don't do {%H-} etc: > > procedure CreateTTFCIDSystemInfo(const {%H-}EmbeddedFontNum: > integer;{%H-}FontDef: TFontDef);virtual; > {$HINTS OFF} instead of it? > Typecasts like this should also not be done: > > +Font

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread silvioprog
On Thu, Mar 31, 2016 at 1:26 PM, Graeme Geldenhuys < mailingli...@geldenhuys.co.uk> wrote: [...] > On 2016-03-31 17:13, Michael Van Canneyt wrote: > > I had a look at your PDF. I did not extract the embedded FreeSans font > you have embedded, so don't know the font file version, but based on its >

Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread silvioprog
On Thu, Mar 31, 2016 at 1:13 PM, Michael Van Canneyt wrote: [...] > No, I have one of ~1Mb. But probably logical if the file is not there ? > > It's not quite clear what to think of your report ? > > For me > > "PDF was succefully generated" > > does not compute with > > "Unable to open file "fon

Re: [Lazarus] PDF generator, try 2

2016-04-02 Thread Graeme Geldenhuys
On 2016-04-01 20:16, Jesus Reyes A. wrote: >P.WriteUTF8Text(15, 120, 'Languages: English: Hello, World!'); >P.WriteUTF8Text(40, 130, 'Greek: -FÃåéÜ óïõ êüóìïò'); >P.WriteUTF8Text(40, 140, 'Polish: Witaj -B¶wiecie'); >P.WriteUTF8Text(40, 150, 'Portuguese: Ol-Aá mundo'); > > Of co

Re: [Lazarus] PDF generator, try 2

2016-04-01 Thread Jesus Reyes A.
On Thu, 31 Mar 2016 18:16:18 -0600, Graeme Geldenhuys wrote: BTW, out of curiosity, in the sample there is code like this: lPt1 := P.Matrix.Transform(15, 120); P.WriteUTF8Text(lPt1.X, lPt1.Y, 'Languages: English: Hello, World!'); lPt1 := P.Matrix.Transform(40, 130); P.WriteUTF8Text(l

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Michael Van Canneyt
On Fri, 1 Apr 2016, Ondrej Pokorny wrote: On 31.03.2016 22:58, Michael Van Canneyt wrote: I suspect this can be easily implemented. Synopse pdf is the reason I started fppdf. Synopse is heavily Windows centric, but otherwise quite capable. Yes, correct. I was who implemented exact drawing

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Ondrej Pokorny
On 31.03.2016 22:58, Michael Van Canneyt wrote: I suspect this can be easily implemented. Synopse pdf is the reason I started fppdf. Synopse is heavily Windows centric, but otherwise quite capable. Yes, correct. I was who implemented exact drawing to Synopse PDF (i.e. rendering to exact rect)

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Jesus Reyes A.
En Thu, 31 Mar 2016 18:16:18 -0600, Graeme Geldenhuys escribió: On 2016-03-31 22:18, Jesus Reyes A. wrote: TPDFPage has some basic primitives for drawing: lines, rects, ellipses and images. I don't see a way to add our own (except by patches to fpPDF of course) // Add your custom page

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Graeme Geldenhuys
On 2016-03-31 22:18, Jesus Reyes A. wrote: > TPDFPage has some basic primitives for drawing: lines, rects, ellipses and > images. I don't see a way to add our own (except by patches to fpPDF of > course) I like the idea of giving developers the ability to extend TPDFPage with more drawing fun

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Jesus Reyes A.
On Thu, 31 Mar 2016 14:58:07 -0600, Michael Van Canneyt wrote: Synopse pdf is the reason I started fppdf. Synopse is heavily Windows centric, but otherwise quite capable. Fppdf is a young library (although it required many months of work) I am sure many improvements will be made as the repo

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, Ondrej Pokorny wrote: On 31.03.2016 20:39, Michael Van Canneyt wrote: On Thu, 31 Mar 2016, Ondrej Pokorny wrote: A quick question (sorry I haven't tested): is word breaking supported and is it possible to get the target rect of multiline and singleline text? It is pos

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Ondrej Pokorny
On 31.03.2016 20:39, Michael Van Canneyt wrote: On Thu, 31 Mar 2016, Ondrej Pokorny wrote: A quick question (sorry I haven't tested): is word breaking supported and is it possible to get the target rect of multiline and singleline text? It is possible to get a target rect of a single line; u

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, Ondrej Pokorny wrote: A quick question (sorry I haven't tested): is word breaking supported and is it possible to get the target rect of multiline and singleline text? It is possible to get a target rect of a single line; unit fpttf: function TextWidth(AStr: string; APo

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Ondrej Pokorny
A quick question (sorry I haven't tested): is word breaking supported and is it possible to get the target rect of multiline and singleline text? Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.o

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Graeme Geldenhuys
On 2016-03-31 17:17, Michael Van Canneyt wrote: > - Arr.AddIntArray(FontDef.FCharWidth); > + Arr.AddIntArray(string(FontDef.FCharWidth)); > > We need to investigate why you think this typecast is needed. Plus the fact that I haven't complete all the code clean-up yet. As far as I can see all t

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Graeme Geldenhuys
On 2016-03-31 17:13, Michael Van Canneyt wrote: >> I have some observations: >> >> . The demo print a lot of lines if the font is not found: >> >> Exception at 0041F4B7: EFOpenError: >> Unable to open file "fonts\FreeSans.ttf". I believe the loop is caused by the usage of TCustomApplication (the

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 11:18 AM, silvioprog wrote: On Thu, Mar 31, 2016 at 11:02 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: Hello In revision 33401 of FPC subversion, a lot of fixes have been committed for Font handling in the PDF gen

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 12:45 PM, silvioprog wrote: On Thu, Mar 31, 2016 at 11:18 AM, silvioprog wrote: On Thu, Mar 31, 2016 at 11:02 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: Hello In revision 33401 of FPC subversion, a lot of fix

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread silvioprog
On Thu, Mar 31, 2016 at 12:45 PM, silvioprog wrote: > On Thu, Mar 31, 2016 at 11:18 AM, silvioprog wrote: > >> On Thu, Mar 31, 2016 at 11:02 AM, Michael Van Canneyt < >> mich...@freepascal.org> wrote: >>> >>> Hello >>> >>> In revision 33401 of FPC subversion, a lot of fixes have been committed >

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread silvioprog
On Thu, Mar 31, 2016 at 11:18 AM, silvioprog wrote: > On Thu, Mar 31, 2016 at 11:02 AM, Michael Van Canneyt < > mich...@freepascal.org> wrote: >> >> Hello >> >> In revision 33401 of FPC subversion, a lot of fixes have been committed >> for Font >> handling in the PDF generator: e.g. Unicode fonts

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread silvioprog
On Thu, Mar 31, 2016 at 11:02 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: > > Hello > > In revision 33401 of FPC subversion, a lot of fixes have been committed > for Font > handling in the PDF generator: e.g. Unicode fonts should now render > correctly. [...] Great news! :-) I'm goi

Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Aradeonas
Very good. Thanks. Red line left margin has problem in Google chrome default PDF viewer, maybe it is Chrome problem but I think you should know. Regards, Ara -- http://www.fastmail.com - Faster than the air-speed velocity of an unladen european swallow --

[Lazarus] PDF generator, try 2

2016-03-31 Thread Michael Van Canneyt
Hello In revision 33401 of FPC subversion, a lot of fixes have been committed for Font handling in the PDF generator: e.g. Unicode fonts should now render correctly. The test program generates the following PDF: http://www.freepascal.org/~michael/test.pdf Page 1 looks as follows on my system: