[Lazarus] Can some fix this "make" issue? Pi related.
I believe this problem effects a lot of people using the Raspberry Pi, and possibly other platforms as well. The problem: Recently I been using "make all" on Lazarus sources, or trying to rebuild the IDE, such as when installing or removing packages, and experiencing build fails. This will happen on the Raspberry Pi when 128MB or more memory is assigned to the GPU, a setting which must be configured to allow for video playback and/or GLES to run on the Pi. For those of you not experiencing this issue you may have left the GPU size at its default 64MB setting. When a system such as the Pi has less than 700MB (approximately) of free memory the "make all" or rebuilding the IDE task will fail with errors such as" switching to an external resource compiler" or some other mysterious message. Temporarily lowering the GPU memory, rebooting the computer, rebuilding Lazarus, changing the GPU memory back, then rebooting the computer again fixes the problem, but this is a very awkward solution. This is especially awkward considering you may need to do this anytime you want to add or remove component in Lazarus under the conditions I've described. My question is can someone look into this issue so that building Lazarus in environments where free memory is than 700MB does not result in Lazarus build failures? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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) because the font sizes on Canvas and PDF were quite different. IIRC you compare the actual text width with the wanted text width and you scale the text box with a transformation. I also implemented underline text and did more enhancements, I don't remember exactly any more. It was years ago. Now I stay before a choice to use Synopse PDF (and to have PDF export Windows-only) or create a new bindings to fppdf. Fppdf is a young library (although it required many months of work) I am sure many improvements will be made as the reporting library develops. A canvas descendant that renders to pdf is planned, but not very high priority. Patches and suggestions are definitely welcome. The library is intended for production, so quality is important. I have to take a look at fppdf. I'll need a PDF export in the next months. If I decide for fppdf you can be sure that I'll make you busy with sending patches :) Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
En Thu, 31 Mar 2016 18:16:18 -0600, Graeme Geldenhuysescribió: 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 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. Jesus Reyes A. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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 functions. Good news is, it is quite possible already, with one minor modifications - TPDFPages needs to surface a Add(APage: TPDFPage) procedure. I just made the change locally and managed to add my own drawing function as follows: type // page class with new custom drawing methods TMyPDFPage = class(TPDFPage) public procedure DrawRoundedRect(...); end; // 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 // painting our custom page. P is a TMyPDFPage type. P := TMyPDFPage(FDoc.Pages[5]); // get our page reference { call a custom draw function from our custom class } P.DrawRoundedRect(...); I'll send the changes to Michael so he can update fcl-pdf. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is there some way to build a package for all widgsets in one go like the IDE's Build Many option?
On 31 March 2016 at 22:35, Mattias Gaertnerwrote: > On Thu, 31 Mar 2016 22:17:20 +0100 > "vfclists ." wrote: > > >[...] > > I suppose that this depends on using building a project with the right > > widgetset? My thoughts where more along the line of using the Compile > > button on the package to compile for all the chosen widgetsets in one go. > > With "chosen" I guess you mean build modes. > You can use "Run / Build many Modes ..." to compile for all the chosen > widgetsets in one go. > > Mattias > I am thinking along the lines of compiling "a package only". The Compile settings for packages don't have a "Run/Build Many Modes...". That only applies to Projects. > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- Frank Church === http://devblog.brahmancreations.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is there some way to build a package for all widgsets in one go like the IDE's Build Many option?
On Thu, 31 Mar 2016 22:17:20 +0100 "vfclists ."wrote: >[...] > I suppose that this depends on using building a project with the right > widgetset? My thoughts where more along the line of using the Compile > button on the package to compile for all the chosen widgetsets in one go. With "chosen" I guess you mean build modes. You can use "Run / Build many Modes ..." to compile for all the chosen widgetsets in one go. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xamarin becomes free and open-source
On 31.03.2016 23:14, vfclists . wrote: > > They have recently announced Bash for Windows and they are aiming to get > a lot of Unix tools running easily on Windows. > In fact those tools have been there for a while but they were not > seriously promoted. > They announced the ability to run ELF binaries on Windows. Basically an advanced/improved version of their POSIX/Unix subsystem that they had from NT times till Windows 8 (exclusive if I remember correctly). Unlike then the binaries now run as is (back then one needed to compile them from source with an adjusted gcc, but it worked rather nicely :) ) Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
On Thu, 31 Mar 2016 14:58:07 -0600, Michael Van Canneytwrote: 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 reporting library develops. A canvas descendant that renders to pdf is planned, but not very high priority. Patches and suggestions are definitely welcome. The library is intended for production, so quality is important. Michael. 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) but it would be nice to have some mechanism for extension, for example if a TPdfPageClass=class of TPdfClass is defined, then there could be a TPdfPages.AddPage overloaded with an extra argument PageClass:TPdfPageClass, and this could be used for implementing additional primitives? what you hink? Regards. Jesus Reyes A. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is there some way to build a package for all widgsets in one go like the IDE's Build Many option?
On 31 March 2016 at 21:49, Mattias Gaertnerwrote: > On Thu, 31 Mar 2016 21:38:46 +0100 > "vfclists ." wrote: > > > Is there some way to build a package for all widgsets in one go like the > > IDE's Build Many option? > > > > Changing widgetsets results in a recompile of a lot of GUI packages and > > wonder whether that can be avoided. Adding the LCLWidget to the output > path > > of packages doesn't seem to work. > > Adding the LCLWidgetType to the output directory allows to compile > for each widgetset only once. The Lazarus sources use that too. > > Mattias > > I suppose that this depends on using building a project with the right widgetset? My thoughts where more along the line of using the Compile button on the package to compile for all the chosen widgetsets in one go. > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- Frank Church === http://devblog.brahmancreations.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xamarin becomes free and open-source
On 31 March 2016 at 21:56, Denis Kozlovwrote: > On 31/03/2016 21:31, vfclists . wrote: > >> They are going all out against Apple and Redhat. >> > > You meant Apple and Google maybe? They target Windows, Mac/iOS and Android. > > A wide selection of supported platforms is where FPC and Lazarus defiantly > have an edge. > > Denis > > > Microsoft earns some patent fees from every single Android device sold. They've lost the mobile war for the next few years to come until Xamarin makes app development easy for Windows for developers to produce more apps for the mobile platform. They are definitely going after Redhat, and Oracle in the short-term. They are not going the mistake they made with Apple. SQL Server will be available for Linux quite soon. They have recently announced Bash for Windows and they are aiming to get a lot of Unix tools running easily on Windows. In fact those tools have been there for a while but they were not seriously promoted. They are going after the whole Linux.Unix system. They want Linux admins and developers to realize that they can have good GUI development and server-management tools available on Windows and still have all the command line goodies they've learned to love on Linux. Given the lack of integrated toolsets available for Linux, they will probably make it. -- Frank Church === http://devblog.brahmancreations.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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 possible to get a target rect of a single line; unit fpttf: function TextWidth(AStr: string; APointSize: single): single; Word breaking is left to the calling application. A reporting tool is in the make (well, made, but not released yet) which will handle this. Great, thank you! And is it possible the other way round? I.e. I know the target rect and I have to export a single line exactly into that rect? (The text has to be scaled to fill the rect.) I suspect this can be easily implemented. Why I ask: I need to print my PDFs directly from a Lazarus application. I have to render the page on a canvas (monitor for preview, printer for printing) and create a PDF from the same source. All three targets (monitor, printer, PDF) have to be exactly equal. I achieved this in Delphi with Synopse PDF. Now I'd like to port my reporting solution to Lazarus. 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 reporting library develops. A canvas descendant that renders to pdf is planned, but not very high priority. Patches and suggestions are definitely welcome. The library is intended for production, so quality is important. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xamarin becomes free and open-source
On 31/03/2016 21:31, vfclists . wrote: They are going all out against Apple and Redhat. You meant Apple and Google maybe? They target Windows, Mac/iOS and Android. A wide selection of supported platforms is where FPC and Lazarus defiantly have an edge. Denis -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is there some way to build a package for all widgsets in one go like the IDE's Build Many option?
On Thu, 31 Mar 2016 21:38:46 +0100 "vfclists ."wrote: > Is there some way to build a package for all widgsets in one go like the > IDE's Build Many option? > > Changing widgetsets results in a recompile of a lot of GUI packages and > wonder whether that can be avoided. Adding the LCLWidget to the output path > of packages doesn't seem to work. Adding the LCLWidgetType to the output directory allows to compile for each widgetset only once. The Lazarus sources use that too. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xamarin becomes free and open-source
On Thu, 31 Mar 2016, Maciej Izak wrote: 2016-03-31 20:30 GMT+02:00 Anthony Walter: I thought this was newsworthy and of interest to us: https://blog.xamarin.com/xamarin-for-all/ kind of inspiration for better Lazarus and FreePascal I fail to see how ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Is there some way to build a package for all widgsets in one go like the IDE's Build Many option?
Is there some way to build a package for all widgsets in one go like the IDE's Build Many option? Changing widgetsets results in a recompile of a lot of GUI packages and wonder whether that can be avoided. Adding the LCLWidget to the output path of packages doesn't seem to work. The only way I can think of is to have separate Lazarus builds for each widget set which share the same --pcp option. For cross-platform I mainly use Qt as the GTK widget set doesn't seem to work well on Windows. -- Frank Church === http://devblog.brahmancreations.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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; unit fpttf: function TextWidth(AStr: string; APointSize: single): single; Word breaking is left to the calling application. A reporting tool is in the make (well, made, but not released yet) which will handle this. Great, thank you! And is it possible the other way round? I.e. I know the target rect and I have to export a single line exactly into that rect? (The text has to be scaled to fill the rect.) Why I ask: I need to print my PDFs directly from a Lazarus application. I have to render the page on a canvas (monitor for preview, printer for printing) and create a PDF from the same source. All three targets (monitor, printer, PDF) have to be exactly equal. I achieved this in Delphi with Synopse PDF. Now I'd like to port my reporting solution to Lazarus. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is there some way to build a package for all widgsets in one go like the IDE's Build Many option?
On 31.03.2016 22:38, vfclists . wrote: Is there some way to build a package for all widgsets in one go like the IDE's Build Many option? Changing widgetsets results in a recompile of a lot of GUI packages and wonder whether that can be avoided. Adding the LCLWidget to the output path of packages doesn't seem to work. The only way I can think of is to have separate Lazarus builds for each widget set which share the same --pcp option. For cross-platform I mainly use Qt as the GTK widget set doesn't seem to work well on Windows. You can use different target directories for different targets/widgetsets in Additions and Overrides. See http://wiki.freepascal.org/IDE_Window:_Compiler_Options#Change_the_output_directory_of_project_and_all_packages Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xamarin becomes free and open-source
On Thu, Mar 31, 2016 at 4:31 PM, vfclists .wrote: > > Microsoft are not interested in FreePascal and Lazarus. > > They are going all out against Apple and Redhat. > Xamarin is using native controls, just like LCL does. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xamarin becomes free and open-source
On 31 March 2016 at 20:21, Maciej Izakwrote: > > 2016-03-31 20:30 GMT+02:00 Anthony Walter : > >> I thought this was newsworthy and of interest to us: >> >> https://blog.xamarin.com/xamarin-for-all/ >> > > kind of inspiration for better Lazarus and FreePascal? > > Microsoft are not interested in FreePascal and Lazarus. They are going all out against Apple and Redhat. -- Frank Church === http://devblog.brahmancreations.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
Am 31.03.2016 um 17:04 schrieb Juha Manninen: Anyway, the original issue was about inserting {codepage UTF8} automatically to every unit. We can conclude it is not a good idea. It does not solve anything when using plain constants with default String type but adds conversion overhead. It breaks things when using constants with ShortString and PChar. I'm on your side. It was a good thing to ask here, cause it pointed out, that the disadvantages predominate the advantages. Im clear for myself to that issue and can see the results in my tests too. Thank you very much Kind regards Michl -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Merge request
On Thu, 31 Mar 2016 11:45:48 -0600, Ondrej Pokornywrote: On 31.03.2016 12:59, Gabor Boros wrote: Please merge 52063, 52029, 51980, 51918, 51914 revisions (grid fixes) from trunk to fixes_1_6. Please add them into http://wiki.freepascal.org/Lazarus_1.6_fixes_branch section Merge requests/Submitted by others. Ondrej I marked some reports with a LazTarget 1.6.2 those should be merged to 1.6.2 as their fixes have high probability to be harmless or they fix regressions, the ones marked with LazTarget 1.8 should be thoroughly tested in 1.7.0 before they can be merged. Well, I know this can't be objectively evaluated so give them a couple of weeks in the wild at least. Jesus Reyes A. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
Am 31.03.2016 um 12:44 schrieb Mattias Gaertner: On Thu, 31 Mar 2016 00:16:13 +0200 "Michael W. Vogel"wrote: [...] I've tested the example too and I got different results with different options. The test was: - BOM / no BOM at the beginning of the sourcefile - {$codepage UTF8} or not The compiler understands -FcUTF8, {$codepage utf8} and BOM. All three sets UTF-8. See here: http://wiki.freepascal.org/FPC_Unicode_support#Source_file_codepage BOM has the advantage that it is understood by other text editors as well and the disadvantage that it is hidden, so that people unaware of encodings are easily confused. -FcUTF8 has the advantage of applying it to all sources in the project/package and it can easily be turned off. You can unset it for a single unit via {$modeswitch systemcodepage}. - fpc -MObjFPC *-Sh* test.pas (with / without -Sh (use reference counted strings)) And this is where the confusion starts. Mixing multiple string types is asking for troubles. FPC has an impressive (aka frightening) list of string types and consequently a vast net of combinations that only graph theorists can appreciate. So it is realy more complex as I thought... Yes. And you have not yet explored the difficulties in code supporting both FPC 2.6.4 and 3+ and LCL 1.4 and 1.6. Although Lazarus recommends to "simply" use UTF-8, technically it recommends AnsiString, DefaultSystemCodepage CP_UTF8, no explicit codepage, and the UTF-8 functions in LazUtils. If you need to use other string types in an unit you might want to add an explicit codepage. Maybe a paragraph should be added to the wiki about using non AnsiString with the "Lazarus UTF-8". Mattias Thank you very much, for your detailed answer! I'll try to run some more tests, to understand why a BOM for UTF-8 has a other behaviour than a {$codepage UTF8}. BTW the conversions here has nothing to do with Lazarus, it is only a FPC issue. If I don't find a answer for myself, I'll ask in the FPC mailing list. Thanks again Kind regards Michl -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xamarin becomes free and open-source
2016-03-31 20:30 GMT+02:00 Anthony Walter: > I thought this was newsworthy and of interest to us: > > https://blog.xamarin.com/xamarin-for-all/ > kind of inspiration for better Lazarus and FreePascal? -- Best regards, Maciej Izak -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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; APointSize: single): single; Word breaking is left to the calling application. A reporting tool is in the make (well, made, but not released yet) which will handle this. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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.org/mailman/listinfo/lazarus
[Lazarus] Xamarin becomes free and open-source
I thought this was newsworthy and of interest to us: https://blog.xamarin.com/xamarin-for-all/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Merge request
On 31.03.2016 12:59, Gabor Boros wrote: Please merge 52063, 52029, 51980, 51918, 51914 revisions (grid fixes) from trunk to fixes_1_6. Please add them into http://wiki.freepascal.org/Lazarus_1.6_fixes_branch section Merge requests/Submitted by others. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] System variables visibility
On 31.03.2016 17:16, John Landmesser wrote: Hi, i developed an application ( Linux ) that need to know where $ORACLE_HOME points to. The only way was to start my app with a shell-script, defining: #! /bin/bash export ORACLE_HOME=/usr/lib/oracle/ # run my app Lazarus_Oracle_app Had no success defining this variable in bashrc or profile. But why do i have to define this in my start-script? Annotation: perhaps i have to search the sources of ZeosLib, that i'm using because of german Umlauts-problems in OracleConnection Thanks for tipps!! -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus i think i found the explanation: oracle tells me: 3. Set the environment variable LD_LIBRARY_PATH to the appropriate directory for the Instant Client version, for example: export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib:$LD_LIBRARY_PATH so $ORACLE_HOME is not needed but on modern Linux LD_LIBRARY_PATH is ALLWAYS empty, even if its declared in bashrc or profile I didn't tell you that i defined LD_LIBRARY_PATH in my script and LD_LIBRARY_PATH is blanked as i remember and testet just now. Debian Sid. Uh thats all really tricky and i'm no geek :-)) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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 the TFontDef related code is legacy - related to when the pdf code still used *.fnt files, instead of querying *.ttf files directly. What does depend on the TFontDef structure can easily be replaced by finding the info directly from the TTF file. The TTextDictionary class can be removed as well. That has been replaced by TTextMappingList & TTextMapping classes. As you might know [Michael], my last concern was compiler hints. ;-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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 previous test app didn't use TCustomApplication). And yes, the demo requires that TTF file otherwise the text output will not work. >> . The PDF was generated with some wrong chars (you can download it here: >> https://dl.dropboxusercontent.com/u/135304375/test.pdf): > > That is logical, if it cannot find the file which it tries to embed ?? 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 size (264KB) it is a very old FreeSans.ttf file. The one I tested with is 1.56MB in size. If I must, I can extract your embedded FreeSans font to query it further and see the version and glyph count it defines. >> Greek: Ge?? s?? ??s >> Polish: Witaj swiecie This tells me your version of FreeSans.ttf doesn't have all the glyphs the demo uses. > "PDF was succefully generated" > > does not compute with > > "Unable to open file "fonts\FreeSans.ttf". Indeed. :) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
On Thu, 31 Mar 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 11:18 AM, silvioprogwrote: 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 going to re-test it ... Finally the PDF was succefully generated on Windows! \o/ 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". Exception at 0041F4B7: EFOpenError: Unable to open file "fonts\FreeSans.ttf". Exception at 0041F4B7: EFOpenError: Unable to open file "fonts\FreeSans.ttf". Exception at 0041F4B7: EFOpenError: Unable to open file "fonts\FreeSans.ttf". ... infinitely ... . The PDF was generated with some wrong chars (you can download it here: https://dl.dropboxusercontent.com/u/135304375/test.pdf): That is logical, if it cannot find the file which it tries to embed ?? Greek: Ge?? s?? ??s Polish: Witaj swiecie Portuguese: Ol? mundo Russian: ??? Vietnamese: Xin ch?o th? gi?i In the previous fppdf version, the PDF was generated about ~650KB, after update it I get a PDF ~381KB. Is it OK? 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 "fonts\FreeSans.ttf". :-) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
On Thu, 31 Mar 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 12:45 PM, silvioprogwrote: 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 should now render correctly. [...] Great news! :-) I'm going to re-test it ... Finally the PDF was succefully generated on Windows! \o/ The attached patch remove some compile hints/warnings. Please, don't do {%H-} etc: procedure CreateTTFCIDSystemInfo(const {%H-}EmbeddedFontNum: integer;{%H-}FontDef: TFontDef);virtual; Typecasts like this should also not be done: +FontDef.FDiffs := WideString(lFontDef.Diffs); +FontDef.FCharWidth := WideString(lFontDef.CharWidths); - Arr.AddIntArray(FontDef.FCharWidth); + Arr.AddIntArray(string(FontDef.FCharWidth)); We need to investigate why you think this typecast is needed. The buffer initialization is good, though. I will not apply this patch, this needs deeper investigation. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
On Thu, Mar 31, 2016 at 12:45 PM, silvioprogwrote: > 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 should now render >>> correctly. >> >> [...] >> >> Great news! :-) >> >> I'm going to re-test it ... >> > > Finally the PDF was succefully generated on Windows! \o/ > The attached patch remove some compile hints/warnings. -- Silvio Clécio 0001-Remove-hints-warnings.patch Description: Binary data -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
On Thu, Mar 31, 2016 at 11:18 AM, silvioprogwrote: > 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 going to re-test it ... > Finally the PDF was succefully generated on Windows! \o/ 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". Exception at 0041F4B7: EFOpenError: Unable to open file "fonts\FreeSans.ttf". Exception at 0041F4B7: EFOpenError: Unable to open file "fonts\FreeSans.ttf". Exception at 0041F4B7: EFOpenError: Unable to open file "fonts\FreeSans.ttf". ... infinitely ... . The PDF was generated with some wrong chars (you can download it here: https://dl.dropboxusercontent.com/u/135304375/test.pdf): Greek: Ge?? s?? ??s Polish: Witaj swiecie Portuguese: Ol? mundo Russian: ??? Vietnamese: Xin ch?o th? gi?i In the previous fppdf version, the PDF was generated about ~650KB, after update it I get a PDF ~381KB. Is it OK? -- Silvio Clécio -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] System variables visibility
On 03/31/2016 05:16 PM, John Landmesser wrote: Hi, i developed an application ( Linux ) that need to know where $ORACLE_HOME points to. The only way was to start my app with a shell-script, defining: #! /bin/bash export ORACLE_HOME=/usr/lib/oracle/ # run my app Lazarus_Oracle_app Had no success defining this variable in bashrc or profile. But why do i have to define this in my start-script? That's how unix works. Or add it to your start script or add /usr/lib/oracle to the /etc/ld.so.conf, or in modern distros create file in /etc/ld.so.conf.d/myoraclepath and put inside /usr/lib/oracle And all of that is to satisfy LD_LIBRARY_PATH. ORACLE_HOME is oracle only env variable, so maybe you must export it all the time via script or add it to $HOME/.bashrc so it will be always exported after login. zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] System variables visibility
On Thu, 31 Mar 2016, John Landmesser wrote: Hi, i developed an application ( Linux ) that need to know where $ORACLE_HOME points to. The only way was to start my app with a shell-script, defining: #! /bin/bash export ORACLE_HOME=/usr/lib/oracle/ # run my app Lazarus_Oracle_app Had no success defining this variable in bashrc or profile. That should work. Obviously you need to log in again. But why do i have to define this in my start-script? That should not be necessary. I have similar variables defined for Firebird, in my .login file. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] System variables visibility
Hi, i developed an application ( Linux ) that need to know where $ORACLE_HOME points to. The only way was to start my app with a shell-script, defining: #! /bin/bash export ORACLE_HOME=/usr/lib/oracle/ # run my app Lazarus_Oracle_app Had no success defining this variable in bashrc or profile. But why do i have to define this in my start-script? Annotation: perhaps i have to search the sources of ZeosLib, that i'm using because of german Umlauts-problems in OracleConnection Thanks for tipps!! -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On 3/31/16, Juha Manninenwrote: >> In my fantasy scenario the String would of course have the meaning of >> UnicodeString. > > That is not anyhow better (or worse) inherently than a UTF-8 based > solution. No, but I don't see fpc moving towards String equals AnsiString(CP_UTF8). It would be hugely Delphi imcompatible. For me personally Delphi compatibility does not matter at all, I have left Delphi and won't return. But from the fpc side, breaking compatibility in such a way is probably going to be a big no-no. But you are rigt, we are getting off-topic more and more. Sorry for that. Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Thu, Mar 31, 2016 at 5:20 PM, Bartwrote: > In my fantasy scenario the String would of course have the meaning of > UnicodeString. That is not anyhow better (or worse) inherently than a UTF-8 based solution. Delphi just happened to implement it so, for various reasons. The surprise is that our system is so Delphi compatible even while having a different encoding. > The tests I posted in this thread were plain fpc programs, > so no use of LazUtf8. It pointed out that the Lazarus part of > the wiki (Better Unicode support) could be interpreted wrong. No. You interpreted it wrong for some reason. The page is only about the new Unicode support which is very clearly mentioned there! You don't have to use the UTF-8 mode which is explained in another page : http://wiki.freepascal.org/Lazarus_with_FPC3.0_without_UTF-8_mode The main message however is that the new mode should be used unless there is a very good reason not to. That's why it was made default when LazUtils / LazUTF8 is used. For console apps you must add the dependency / unit explicitly but it does not change any facts about the mode. Anyway, the original issue was about inserting {codepage UTF8} automatically to every unit. We can conclude it is not a good idea. It does not solve anything when using plain constants with default String type but adds conversion overhead. It breaks things when using constants with ShortString and PChar. It only improves things with UnicodeString constants which is not necessarily needed at all, but can be used with added {codepage UTF8}. Simple, no hassle! Besides I feel the problems are exaggerated again. The problems discussed here are only about constants. The automatic conversion between variables works always. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange error with TValueListEditor
On 31 March 2016 at 15:03, Bartwrote: > I see no real difference in the lfm structure (apart from the fact > that the problematic one has OnStringsChange = > vle11TrunkPropertiesStringsChange, which sould not raise the error you > mentioned) > > Does the form contain any other components that are NOT installed in > the "minimal IDE"? > I'm asking because in that case I will ot be able to load the form > (especially if it has third-party controls). > No, I'm pretty sure it doesn't > > For testing purposes in priciple I only need the form > (lfm+sourcecode), not the entire project. I don't need to compile it, > jus be able to load the form. > You can send it to my private email adress, I will treat is as > copyrighted material. > emailed the project to you privately. Thanks Richard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On 3/31/16, Juha Manninenwrote: > I doubt you will change every "String" into "UnicodeString" in your code. > Somehow you missed the fundamental idea of our new Unicode system. > "String" has Unicode and you don't need to care about it, or even > about endianess. > Delphi reaches the same goal by mapping String -> UnicodeString. > When you need Ansi codepages then you need to pay attention obviously, > otherwise not. In my fantasy scenario the String would of course have the meaning of UnicodeString. > Bart, were your earlier results caused by NOT using the new Unicode > support? The tests I posted in this thread were plain fpc programs, so no use of LazUtf8. It pointed out that the Lazarus part of the wiki (Better Unicode support) could be interpreted wrong. > The whole discussion was about the new Unicode support and you have > been testing it since the beginning. I have use the "Utf8 in RTL" ever since i swithed to the 3.0 compiler (I have to admit I was to scared to test the 2.7 branch, but I started with the first 3.0 RC), and the number of bugs we had to fix was far, far less than I thought it would be. Most of my own programs seem to require no change at all. The main excpetion being my backupprogram, but not beause it stopped correctly accessing filenames with unicode cahracter in their path, but because I used a procedural paramter in it's engine, for which now the signature had changed from plain string to either RawByteString or UnicodeString. All this was solved (with ifdefs for the 2.6 compiler) quit easily. And as I pointed out to you earlier in another thread in the forum, the "new UTF8 system" works even better than I thought. Then again, I do not use databases in any of my programs, so I don't have to deal with that part of the problem. All my textual data is stored in plain textfiles in UTF8 encoding, probably from the day I started using Lazarus as my main platform (0.9.16). Anyhow, it's a fascinating issue, and the more I understand about it, the better I am able to fix encoding related problems in our (or user's) code. Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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 going to re-test it ... -- Silvio Clécio -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator, try 2
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 mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange error with TValueListEditor
I see no real difference in the lfm structure (apart from the fact that the problematic one has OnStringsChange = vle11TrunkPropertiesStringsChange, which sould not raise the error you mentioned) Does the form contain any other components that are NOT installed in the "minimal IDE"? I'm asking because in that case I will ot be able to load the form (especially if it has third-party controls). For testing purposes in priciple I only need the form (lfm+sourcecode), not the entire project. I don't need to compile it, jus be able to load the form. You can send it to my private email adress, I will treat is as copyrighted material. Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] PDF generator, try 2
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: http://www.freepascal.org/~michael/pdftest.png The output has been tested for correct rendering in the following applications: Firefox native viewer (Linux) Acrobat Reader 10 (Windows) Foxit Reader (Windows) Xpdf (FreeBSD) Evince (FreeBSD) The GIMP (FreeBSD) Google Drive viewer LibreOffice Draw (linux) Okular (linux) The file was also generated on various platforms to make sure all platforms handle the generating correctly (locales, code pages etc.). If you find any more errors (let's hope not), please let me know. Enjoy, Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange error with TValueListEditor
On 31 March 2016 at 14:39, Bartwrote: > On 3/31/16, Richard Mace wrote: > > > I've tested it in 1.6, in Ubuntu 14.04 and it comes up with the same > > error. > > Strange indeed. > Which fpc version? > 2.6.4 With Lazarus 1.4.4 and 3.0.0 with Lazarus 1.6 > Can you attach the project (zipped source) here? > It's not Open Source, but I don't mind emailing it to you personally? > > If you start a new project with a TValueListEditor, save, quit > Lazarus, restart: same problem? > Nope, works fine. > If not: does the lfm look different? > A bit: object ValueListEditor1: TValueListEditor Left = 8 Height = 100 Top = 8 Width = 200 FixedCols = 0 RowCount = 2 TabOrder = 0 Strings.Strings = ( '' ) ColWidths = ( 64 132 ) end Thanks for your help Richard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Thu, Mar 31, 2016 at 4:25 PM, Bartwrote: > in this scenario adding {$codepage utf8} may be the wise thing to do: > it eliminates all confusion about the intended encoding of the string > constant. How is a conversion to UTF-16 and then back to UTF-8 less confusing than a direct copy without conversions? > When you use UnicodeString everywhere and no AnsiString anywhere, then > the only confusion left is Endianess,or am I (as one of the Universes > idiots) oversimplifying here. I doubt you will change every "String" into "UnicodeString" in your code. Somehow you missed the fundamental idea of our new Unicode system. "String" has Unicode and you don't need to care about it, or even about endianess. Delphi reaches the same goal by mapping String -> UnicodeString. When you need Ansi codepages then you need to pay attention obviously, otherwise not. Bart, were your earlier results caused by NOT using the new Unicode support? I am surprised if that is the case. The whole discussion was about the new Unicode support and you have been testing it since the beginning. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Thu, 31 Mar 2016 15:25:03 +0200 Bartwrote: > On 3/31/16, Mattias Gaertner wrote: > > >> Will all this mess go away if we would go the Delphi way > >> (String=UnicodeString)? > >> (I know *nix users are going to hate me now) > > > > Which mess do you mean? > > As long as you have to consider codepages, you can get a mess. > > When you use UnicodeString everywhere and no AnsiString anywhere, then > the only confusion left is Endianess,or am I (as one of the Universes > idiots) oversimplifying here. No, you are right. If you somehow(TM) achieve to work only with UnicodeString you avoid the mess. The same if only use UTF-8 strings. Or if you only work in system codepage like in TP 3.0 times. The problem is that you often has to work with databases/files/libs/etc in other encodings. So there is always a little bit of mess. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange error with TValueListEditor
On 3/31/16, Richard Macewrote: > I've tested it in 1.6, in Ubuntu 14.04 and it comes up with the same > error. Strange indeed. Which fpc version? Can you attach the project (zipped source) here? If you start a new project with a TValueListEditor, save, quit Lazarus, restart: same problem? If not: does the lfm look different? Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange error with TValueListEditor
On 31 March 2016 at 13:41, Bartwrote: > On 3/31/16, Richard Mace wrote: > > > Error: Identifier Strings is not published in class "TValueListStrings" > and > > it's highlighted a row that contains: > > Strings.Strings = ('') > > Typically the Strings.Strings should be part of the TValueListEditor. > There should be no TValueListStrings in the lfm. > > Here's anexample of an lfm with a TValueListEditor > > object ValEd: TValueListEditor > Left = 8 > Height = 188 > Top = 8 > Width = 350 > FixedCols = 0 > RowCount = 4 > TabOrder = 0 > OnPrepareCanvas = ValEdPrepareCanvas > KeyOptions = [keyEdit, keyAdd] > Options = [goFixedVertLine, goFixedHorzLine, goVertLine, > goHorzLine, goColSizing, goEditing, goAutoAddRows, goAlwaysShowEditor, > goThumbTracking] > Strings.Strings = ( > 'a=b' > 'c=d' > 'e=f' > ) > ColWidths = ( > 64 > 282 > ) > end > > This is from my ValueListEditor test suite, and it loads without > problems on Lazarus trunk and Lazarus 1.6 (32-bit on Win7-64). > > 1. Can you copy the relevant part of the lfm file and post it here? > object vle11TrunkProperties: TValueListEditor Left = 13 Height = 288 Top = 51 Width = 496 FixedCols = 0 RowCount = 2 TabOrder = 1 Strings.Strings = ( '' ) OnStringsChange = vle11TrunkPropertiesStringsChange ColWidths = ( 64 432 ) end The "Strings.Strings = (" line is what is highlighted with the error: Identifier Strings is not published in class "TValueListStrings" > 2. 1.4 series is old. Please update to 1.6 > I've tested it in 1.6, in Ubuntu 14.04 and it comes up with the same error. Richard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On 3/31/16, Mattias Gaertnerwrote: >> Will all this mess go away if we would go the Delphi way >> (String=UnicodeString)? >> (I know *nix users are going to hate me now) > > Which mess do you mean? > As long as you have to consider codepages, you can get a mess. When you use UnicodeString everywhere and no AnsiString anywhere, then the only confusion left is Endianess,or am I (as one of the Universes idiots) oversimplifying here. In TP 3.0 I didn't have to deal with all this (but then again the guide that came with it was in Hebrew, which was a bit difficult for me). Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Thu, 31 Mar 2016 14:32:27 +0200 Bartwrote: > On 3/31/16, Mattias Gaertner wrote: >[...] > So, when my usecase for string constants with diacritics in real life > most of the time is just captions for buttons/menu's etc., the extra > overhead will not really be something to worry about I guess,and in > this scenario adding {$codepage utf8} may be the wise thing to do: it > eliminates all confusion about the intended encoding of the string > constant. Well, I'm not so sure about the "eliminates all confusion" as Rick Cook said: "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning." > So, my current intended approach for GUI applications will be: > - declare all strings as just String > - have stringconstants with unicode character all in one file and add > {$codepage utf8) to that file, and then don't use -FcUTF8 anymore > (which is what I'm doing ATM), > > That should be rather safe then I guess. Yes. If you avoid PChar(Literal), invalid UTF-8 and #0. > Will all this mess go away if we would go the Delphi way > (String=UnicodeString)? > (I know *nix users are going to hate me now) Which mess do you mean? As long as you have to consider codepages, you can get a mess. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Strange error with TValueListEditor
On 3/31/16, Richard Macewrote: > Error: Identifier Strings is not published in class "TValueListStrings" and > it's highlighted a row that contains: > Strings.Strings = ('') Typically the Strings.Strings should be part of the TValueListEditor. There should be no TValueListStrings in the lfm. Here's anexample of an lfm with a TValueListEditor object ValEd: TValueListEditor Left = 8 Height = 188 Top = 8 Width = 350 FixedCols = 0 RowCount = 4 TabOrder = 0 OnPrepareCanvas = ValEdPrepareCanvas KeyOptions = [keyEdit, keyAdd] Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goEditing, goAutoAddRows, goAlwaysShowEditor, goThumbTracking] Strings.Strings = ( 'a=b' 'c=d' 'e=f' ) ColWidths = ( 64 282 ) end This is from my ValueListEditor test suite, and it loads without problems on Lazarus trunk and Lazarus 1.6 (32-bit on Win7-64). 1. Can you copy the relevant part of the lfm file and post it here? 2. 1.4 series is old. Please update to 1.6 Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On 3/31/16, Mattias Gaertnerwrote: >> AFAIK the IDE does not save the file with a BOM, so the compiler may >> very well decide that my sourcefile has ACP codepage? > > Yes and no. > When the compiler assumes ACP, it treats the string special. It does > not convert it and stores it as byte copy. At runtime the string has > CP_ACP and its codepage is defined by the variable > DefaultSystemCodePage. LazUTF8 sets this to CP_UTF8, so the string is > treated as UTF-8. Note that it does that without any conversion. > > OTOH when you tell the compiler that the source is UTF-8, it converts > the literal to UTF-16. At runtime it converts the string back to UTF-8. > It does that everytime you assign the literal. > > So, with both you get an UTF-8 string, but the latter has a bit more > overhead. Also the latter needs special care when typecasting (e.g. > PChar). So, when my usecase for string constants with diacritics in real life most of the time is just captions for buttons/menu's etc., the extra overhead will not really be something to worry about I guess,and in this scenario adding {$codepage utf8} may be the wise thing to do: it eliminates all confusion about the intended encoding of the string constant. So, my current intended approach for GUI applications will be: - declare all strings as just String - have stringconstants with unicode character all in one file and add {$codepage utf8) to that file, and then don't use -FcUTF8 anymore (which is what I'm doing ATM), That should be rather safe then I guess. Will all this mess go away if we would go the Delphi way (String=UnicodeString)? (I know *nix users are going to hate me now) Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Wed, 30 Mar 2016 18:16:32 +0200 Bartwrote: >[...] > > Any valid UTF-8 string should work, including diacritics. > Without the codepage identier? Yes, if you use LazUTF8. If you don't use LazUTF8 and assign a literal to a UnicodeString you need the codepage. > Quote from http://wiki.freepascal.org/FPC_Unicode_support#String_constants: > "Normally, a string constant is interpreted according to the source > file codepage. If the source file codepage is CP_ACP, a default is > used instead: in that case, during conversions the constant strings > are assumed to have code page 28591 (ISO 8859-1 Latin 1; Western > European). " AFAIK this is not entirely correct. The string literals are assumed to be system codepage, which does not need to be code page 28591. I will ask on the fpc list. > ... > "From the above it follows that to ensure predictable interpretation > of string constants in your source code, it is best to either include > an explicit {$codepage xxx} directive (or use the equivalent -Fc > command line option), or to save the source code in UTF-8 with a BOM. > " > > AFAIK the IDE does not save the file with a BOM, so the compiler may > very well decide that my sourcefile has ACP codepage? Yes and no. When the compiler assumes ACP, it treats the string special. It does not convert it and stores it as byte copy. At runtime the string has CP_ACP and its codepage is defined by the variable DefaultSystemCodePage. LazUTF8 sets this to CP_UTF8, so the string is treated as UTF-8. Note that it does that without any conversion. OTOH when you tell the compiler that the source is UTF-8, it converts the literal to UTF-16. At runtime it converts the string back to UTF-8. It does that everytime you assign the literal. So, with both you get an UTF-8 string, but the latter has a bit more overhead. Also the latter needs special care when typecasting (e.g. PChar). >[...] Consider this test sourcefile (encoded as UTF8 without BOM): >[...] > DefaultSystemcodePage = 1252 >[...] > I would say that this experiment contradicts the statement in > http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus#String_Literals > ? No contradiction, because this wiki page is about DefaultSystemcodePage = CP_UTF8. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Strange error with TValueListEditor
Hi all, I am getting the following error within Lazarus 1.4.4 On Windows 10 when loading my project: Fix LFM file: Error: Identifier Strings is not published in class "TValueListStrings" and it's highlighted a row that contains: Strings.Strings = ('') I have a button that says "Remove all invalid properties" and then I click that, I then get "Division by zero" with just a cancel button. It then takes me to my main.lfm file and then that's it. Every subsequent time I reload Lazarus, I get the same "Division by zero" message and I can no longer view my form. Any ideas please? Thanks Richard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Merge request
Hi All, Please merge 52063, 52029, 51980, 51918, 51914 revisions (grid fixes) from trunk to fixes_1_6. Gabor -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Thu, 31 Mar 2016 00:16:13 +0200 "Michael W. Vogel"wrote: >[...] > I've tested the example too and I got different results with different > options. The test was: > - BOM / no BOM at the beginning of the sourcefile > - {$codepage UTF8} or not The compiler understands -FcUTF8, {$codepage utf8} and BOM. All three sets UTF-8. See here: http://wiki.freepascal.org/FPC_Unicode_support#Source_file_codepage BOM has the advantage that it is understood by other text editors as well and the disadvantage that it is hidden, so that people unaware of encodings are easily confused. -FcUTF8 has the advantage of applying it to all sources in the project/package and it can easily be turned off. You can unset it for a single unit via {$modeswitch systemcodepage}. > - fpc -MObjFPC *-Sh* test.pas (with / without -Sh (use reference counted > strings)) And this is where the confusion starts. Mixing multiple string types is asking for troubles. FPC has an impressive (aka frightening) list of string types and consequently a vast net of combinations that only graph theorists can appreciate. > So it is realy more complex as I thought... Yes. And you have not yet explored the difficulties in code supporting both FPC 2.6.4 and 3+ and LCL 1.4 and 1.6. Although Lazarus recommends to "simply" use UTF-8, technically it recommends AnsiString, DefaultSystemCodepage CP_UTF8, no explicit codepage, and the UTF-8 functions in LazUtils. If you need to use other string types in an unit you might want to add an explicit codepage. Maybe a paragraph should be added to the wiki about using non AnsiString with the "Lazarus UTF-8". Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Using libjpeg
Thanks but I need libjpeg using because of speed and fpimage with UsePalette := False is not fast enough. My tests with libjpeg.dll and this header[1] id much faster than fpimage (half the time) so I wanted to have a native way using pasjpeg instead of a dll. Regards, Ara Links: 1. http://www.dev-center.de/header/libjpeg?cat=header=libjpeg -- http://www.fastmail.com - Same, same, but different... -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Using libjpeg
On Thu, 31 Mar 2016 09:49:44 +0200 (CEST) Michael Van Canneytwrote: > > > On Wed, 30 Mar 2016, Aradeonas wrote: > > > Hi, > > > > I want use libjpeg and I found pasjpeg package in fpc that contains > > jpeglib.pas unit Unit jpeglib does not use libjpeg. > > but I coudnt find a working demo to know how load a > > jpeg file and show it. > > Can anyone point me to a better direction? > > pasjpeg is very low-level. Why not use tfpimage ? > use the fpimage unit, see the example converter program. fpreadjpeg, which is using fpimage, is an example for loading a jpeg using jpeglib. And this in turn is used by the LCL. So, a short LCL example loading and showing a jpeg using jpeglib is: Put a TImage onto the form and add to FormCreate: Image1.Picture.LoadFromFile('example.jpg'); Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Thu, 31 Mar 2016 01:20:14 +0200 Bartwrote: >[...] > I was wondering why DefaultSystemCodepage would return CP_ACP on > Graemes FreeBsd with an UTF8 locale? The problem only exists on Windows (more exact: OS with system codepage<>CP_UTF8). Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
On Thu, 31 Mar 2016 00:26:44 +0200 Bartwrote: > On 3/30/16, Juha Manninen wrote: >[...] > I think the statement in the wiki that {$codepage utf8} is not needed is > wrong. You can use UTF-8 without the {$codepage utf8}. But there are cases where it is needed. Maybe the wording can be improved. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Using libjpeg
On Wed, 30 Mar 2016, Aradeonas wrote: Hi, I want use libjpeg and I found pasjpeg package in fpc that contains jpeglib.pas unit but I coudnt find a working demo to know how load a jpeg file and show it. Can anyone point me to a better direction? pasjpeg is very low-level. Why not use tfpimage ? use the fpimage unit, see the example converter program. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Feature Request: Insert {codepage UTF8} per default
Am 31.03.2016 00:48 schrieb "Bart": > > On 3/31/16, Graeme Geldenhuys wrote: > > > [~]$ echo $LANG > > en_GB.UTF-8 > > This is what I hink is happening to your test (Sven can probably > explain it better): Jonas would probably be a better choice. Or the wiki page where the changes are documented (don't know it right now, but Jonas refers to it rather often :) ) Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus