Re: [Lazarus] Examples of CairoCanvas usage
On 2015-02-13 19:21, Juha Manninen wrote: property PagerWidth: integer read GetPaperWidth; Ah, well spotted. I'll fix this right now. The API is very different than what for example PowerPdf has. As far as I understood the author wrote everything from scratch based directly on the PDF specification - he didn't use any existing projects or libraries as the base. I'm also still in the process of translating all the French words in the code to English. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 9:49 PM, Graeme Geldenhuys mailingli...@geldenhuys.co.uk wrote: The other concern (?) is if the one in trunk could work with FPC 2.6.4 too? In case developers want to use the PDF engine, but not move their projects to FPC trunk (unicode RTL etc). That is not a problem. I am now experimenting with FPC 3 anyway. I am testing the FpGui version until Michael commits his. The dependency for FpGui does not matter during tests. One property name is wrong, should be PaperWidth. property PaperHeight: integer read GetPaperHeight; property PagerWidth: integer read GetPaperWidth; The API is very different than what for example PowerPdf has. I must lean it more and ask questions in FpGui list. Regards, Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 9:14 AM, Petr Kristan petr.kris...@epos.cz wrote: My commandline program version must be linked with gtk in linux. I use this construction: WidgetSet := TGtk2WidgetSet.Create; DrawingRoutine; FreeAndNil(WidgetSet); How to use the WidgetSet? Can you please test with TextOut(), and maybe send a simple example program or application. I still have not found any. I would be happy to add an example directory below components\cairocanvas if you want. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On 2015-02-03 00:01, Juha Manninen wrote: I am most interested in textual data + PDF, thus TCairoPdfCanvas and TCairoPsCanvas, but other examples are welcome, too. Must you use Cairo? I'm just asking, because if Cairo is not a requirement then very good alternatives exits. eg: I've used AggPas (one included with fpGUI as it is more up to date than the Lazarus one) in console and CGI apps to generate graphs and images (with or without text) - no dependencies on GUI toolkits or external libraries. For PDF output, again fpGUI includes an excellent custom written PDF engine which I have used for reporting in my commercial software. It has some excellent features other pascal based PDF engines don't have. I believe Michael van Canneyt also used it as the basis for the new PDF engine included with FPC trunk. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On 2015-02-10 07:14, Petr Kristan wrote: My commandline program version must be linked with gtk in linux. Then it is not really a command line program! ;-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 10:43:34AM +0200, Juha Manninen wrote: On Tue, Feb 10, 2015 at 9:14 AM, Petr Kristan petr.kris...@epos.cz wrote: My commandline program version must be linked with gtk in linux. I use this construction: WidgetSet := TGtk2WidgetSet.Create; DrawingRoutine; FreeAndNil(WidgetSet); How to use the WidgetSet? Can you please test with TextOut(), and maybe send a simple example program or application. I still have not found any. I would be happy to add an example directory below components\cairocanvas if you want. Here is an linux working example: {$mode objfpc}{$H+} uses Classes, SysUtils, Gtk2Int, InterfaceBase, CairoCanvas, GdkCairoCanvas, Printers; var c: TFilePrinterCanvas; begin WidgetSet := TGtk2WidgetSet.Create; c := TCairoPdfCanvas.Create(nil); c.OutputFileName := '/tmp/a.pdf'; c.XDPI := 75; c.YDPI := 75; c.PaperWidth := 100; c.PaperHeight := 100; c.Font.Name := 'Arial'; c.Font.Height := 12; c.TextOut(0, 0, 'Hello word'); FreeAndNil(c); FreeAndNil(WidgetSet); end. Petr -- Petr Kristan . EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice tel: +420 461101401Czech Republic (Eastern Europe) fax: +420 461101481 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On 2015-02-10 09:42, Juha Manninen wrote: I did not know of such PDF engine. So far I know that PowerPdf lib is limited. That's normally the case - the internet is full of unknown gems. :) A couple months back somebody asked about PDF engines in one of the mailing lists. I posted the few I knew about after I did my own research. PowerPDF was not that great. What about font embedding and Unicode support in PDF? Both supported. What is the best way to test it? From fpGUI or from FPC trunk? To be honest, I haven't tried the one Michael created yet. He just asked me how to get in contact with the original author for the PDF engine included with fpGUI so he could ask permission and credit him. Michael is probably the best person to answer questions about the one in FPC trunk. The engine in fpGUI has a very small dependency on fpGUI, but that is very easy to refactor and abstract out. A few minutes work at best. The dependency is mainly due to the print preview window functionality. fpGUI includes a PDF demo: fpgui/examples/gui/reporting/ The demo shows single multiple pages, sections, graphs, outlines, grids, embedded images and font support. It can also preset viewing preferences when viewing with Adobe Acrobat Reader or compatible viewers. Does your version have many dependencies for other parts of fpGUI? No. It is 100% implemented in Object Pascal, and I would estimate 95% is all non-gui code. As I mentioned, it is pretty much only the print preview window which ties it to fpGUI. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 11:22 AM, Graeme Geldenhuys mailingli...@geldenhuys.co.uk wrote: eg: I've used AggPas (one included with fpGUI as it is more up to date than the Lazarus one) in console and CGI apps to generate graphs and images (with or without text) - no dependencies on GUI toolkits or external libraries. For PDF output, again fpGUI includes an excellent custom written PDF engine which I have used for reporting in my commercial software. It has some excellent features other pascal based PDF engines don't have. I believe Michael van Canneyt also used it as the basis for the new PDF engine included with FPC trunk. I did not know of such PDF engine. So far I know that PowerPdf lib is limited. External library dependencies are not desired and this sounds promising! What about font embedding and Unicode support in PDF? What is the best way to test it? From fpGUI or from FPC trunk? Does your version have many dependencies for other parts of fpGUI? Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 11:40 AM, Petr Kristan petr.kris...@epos.cz wrote: c.Font.Name := 'Arial'; c.Font.Height := 12; Wow, my test code only needed the font definition, then it works. My bad, I should have tested that. Normal GUI canvas has some font by default. I added a simple program to components/cairocanvas/example which draws an ellipse and text. You can improve it if you want and send a patch. Your example adds a dependency for GTK2. It is logically wrong if you only want to demonstrate CairoCanvas. My understanding is that GTK2 depends on CairoCanvas, not the other way around. What is the purpose of the WidgetSet variable? You create it but don't use it for anything. My prog works without it now that it has a font defined. The only dependency in the uses section of my program is CairoCanvas. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 2:27 PM, Michael Van Canneyt mich...@freepascal.org wrote: It is a completely reworked version of the one in fpGUI, without external dependencies but with serious improvements: the font embedding in the fpgui version is, well, rudimentary, so that has been completely reworked, it can now embed fonts on-the-fly, without external tools :) I also made a start of improving memory usage, page caching and made the start for compression. I haven't committed the reworked version yet, but it is nearly complete, so you can expect this soon. Sounds very good! This will be included in some future FPC release. Even better! I will be following the trunk commits. BTW, does anybody know how to create PDFs with embedded fonts in a server without X or any other GUI? What libs are needed? Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, 10 Feb 2015 09:22:17 + Graeme Geldenhuys mailingli...@geldenhuys.co.uk wrote: [...] eg: I've used AggPas (one included with fpGUI as it is more up to date than the Lazarus one) in console and CGI apps to generate graphs and images (with or without text) - no dependencies on GUI toolkits or external libraries. Where can I download that aggpas? Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On 2015-02-10 12:27, Michael Van Canneyt wrote: so that has been completely reworked, it can now embed fonts on-the-fly, without external tools :) Oh, that would be a welcome change. Because of that external tool (it worked but was clunky), I kept my reports with the standard PDF fonts. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On 2015-02-10 13:59, Juha Manninen wrote: BTW, does anybody know how to create PDFs with embedded fonts in a server without X or any other GUI? What libs are needed? This should be possible with the one included in fpGUI, once you strip the print preview dependency. Not a large job, so could be done in a pinch until Michael releases the one in FPC trunk. The other concern (?) is if the one in trunk could work with FPC 2.6.4 too? In case developers want to use the PDF engine, but not move their projects to FPC trunk (unicode RTL etc). Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 03:19:23PM +0100, Michael Van Canneyt wrote: On Tue, 10 Feb 2015, Juha Manninen wrote: On Tue, Feb 10, 2015 at 2:27 PM, Michael Van Canneyt mich...@freepascal.org wrote: It is a completely reworked version of the one in fpGUI, without external dependencies but with serious improvements: the font embedding in the fpgui version is, well, rudimentary, so that has been completely reworked, it can now embed fonts on-the-fly, without external tools :) I also made a start of improving memory usage, page caching and made the start for compression. I haven't committed the reworked version yet, but it is nearly complete, so you can expect this soon. Sounds very good! This will be included in some future FPC release. Even better! I will be following the trunk commits. BTW, does anybody know how to create PDFs with embedded fonts in a server without X or any other GUI? What libs are needed? You can check libharu. The only snag is that the Unicode support hasn't been released last time I checked, so you'll have to build the development version from source. We embed the Liberation TrueType fonts and that works quite well. Henry -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 10, 2015 at 03:53:16PM +0200, Juha Manninen wrote: On Tue, Feb 10, 2015 at 11:40 AM, Petr Kristan petr.kris...@epos.cz wrote: c.Font.Name := 'Arial'; c.Font.Height := 12; Wow, my test code only needed the font definition, then it works. My bad, I should have tested that. Normal GUI canvas has some font by default. I added a simple program to components/cairocanvas/example which draws an ellipse and text. You can improve it if you want and send a patch. Your example adds a dependency for GTK2. It is logically wrong if you only want to demonstrate CairoCanvas. My understanding is that GTK2 depends on CairoCanvas, not the other way around. What is the purpose of the WidgetSet variable? You create it but don't use it for anything. My prog works without it now that it has a font defined. The only dependency in the uses section of my program is CairoCanvas. It is about two years when I used this last time. And it was neded. It is good to hear, that I can remove this dependency. Petr -- Petr Kristan . EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice tel: +420 461101401Czech Republic (Eastern Europe) fax: +420 461101481 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On 2015-02-10 21:18, Mattias Gaertner wrote: Where can I download that aggpas? It's included in the fpGUI repo (latest is in the 'develop' branch), but can still be used stand-alone. https://github.com/graemeg/fpGUI/tree/develop/src/corelib/render/software Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, 10 Feb 2015, Graeme Geldenhuys wrote: On 2015-02-10 09:42, Juha Manninen wrote: I did not know of such PDF engine. So far I know that PowerPdf lib is limited. That's normally the case - the internet is full of unknown gems. :) A couple months back somebody asked about PDF engines in one of the mailing lists. I posted the few I knew about after I did my own research. PowerPDF was not that great. What about font embedding and Unicode support in PDF? Both supported. What is the best way to test it? From fpGUI or from FPC trunk? To be honest, I haven't tried the one Michael created yet. He just asked me how to get in contact with the original author for the PDF engine included with fpGUI so he could ask permission and credit him. Michael is probably the best person to answer questions about the one in FPC trunk. It is a completely reworked version of the one in fpGUI, without external dependencies but with serious improvements: the font embedding in the fpgui version is, well, rudimentary, so that has been completely reworked, it can now embed fonts on-the-fly, without external tools :) I also made a start of improving memory usage, page caching and made the start for compression. I haven't committed the reworked version yet, but it is nearly complete, so you can expect this soon. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, 10 Feb 2015, Juha Manninen wrote: On Tue, Feb 10, 2015 at 2:27 PM, Michael Van Canneyt mich...@freepascal.org wrote: It is a completely reworked version of the one in fpGUI, without external dependencies but with serious improvements: the font embedding in the fpgui version is, well, rudimentary, so that has been completely reworked, it can now embed fonts on-the-fly, without external tools :) I also made a start of improving memory usage, page caching and made the start for compression. I haven't committed the reworked version yet, but it is nearly complete, so you can expect this soon. Sounds very good! This will be included in some future FPC release. Even better! I will be following the trunk commits. BTW, does anybody know how to create PDFs with embedded fonts in a server without X or any other GUI? What libs are needed? You can check libharu. Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Mon, Feb 09, 2015 at 09:19:46PM +0200, Juha Manninen wrote: On Linux it does not throw an exception but it does not work either. There is no text. I tested other CairoCanvas variants, PS and PNG, and they behave the same. The code is in ancestor TCairoPrinterCanvas.TextOut. Has anybody tried text output with CairoCanvas? Maybe it only works with graphics. I normaly use it with graphics. My commandline program version must be linked with gtk in linux. I use this construction: WidgetSet := TGtk2WidgetSet.Create; DrawingRoutine; FreeAndNil(WidgetSet); Petr -- Petr Kristan . EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice tel: +420 461101401Czech Republic (Eastern Europe) fax: +420 461101481 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
Strange. I am testing on Windows, Gtk+ for Windows runtime environment is installed. My project depends on cairocanvas_pkg.lpk When I run the test below without the TextOut line, it works and file abcdef.pdf indeed contains an ellipse. With the TextOut line it throws a SIGFPE. I cannot step into the method even with all debug info enabled. In Assembler debug window I can see it happened in _cairo_win32_font_face_scaled_font_create. Ideas? How to solve it? Could it be some missing DLL? It did not complain about DLLs. Am I doing something very stupid? It is possible because I have limited experience with graphics and canvas methods. Juha --- uses ... , CairoCanvas; ... procedure TForm1.Button1Click(Sender: TObject); var PdfCanvas: TCairoPdfCanvas; begin PdfCanvas := TCairoPdfCanvas.Create; try PdfCanvas.OutputFileName := 'abcdef.pdf'; PdfCanvas.Ellipse(20, 20, 50, 70); PdfCanvas.TextOut(50, 100, 'abcdef'); finally PdfCanvas.Free; end; end; --- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Linux it does not throw an exception but it does not work either. There is no text. I tested other CairoCanvas variants, PS and PNG, and they behave the same. The code is in ancestor TCairoPrinterCanvas.TextOut. Has anybody tried text output with CairoCanvas? Maybe it only works with graphics. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Examples of CairoCanvas usage
Does anybody have examples for the package CairoCanvas_pkg that comes with Lazarus? The package dir has none. I am most interested in textual data + PDF, thus TCairoPdfCanvas and TCairoPsCanvas, but other examples are welcome, too. Regards, Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Examples of CairoCanvas usage
On Tue, Feb 03, 2015 at 02:01:27AM +0200, Juha Manninen wrote: Does anybody have examples for the package CairoCanvas_pkg that comes with Lazarus? The package dir has none. I am most interested in textual data + PDF, thus TCairoPdfCanvas and TCairoPsCanvas, but other examples are welcome, too. TCairoCanvas works as clasic TCanvas. You can create TCairo*Canvas of your choice, set some specific properties as OutputFileName, XDPI, YDPI, PaperWidth, PaperHeight, Orientation and draw on it like on normal TCanvas. Petr -- Petr Kristan . EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice tel: +420 461101401Czech Republic (Eastern Europe) fax: +420 461101481 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus