Re: [Lazarus] fpPDF UTF8 encoded PDFString
Am 21.04.2016 um 09:02 schrieb Graeme Geldenhuys: Thanks for the report. What is your platform OS, System Locale for that OS, and what FPC compiler version are you using. I'm on Windows 7, 64bit German locale ACP 1252 FPC trunk revision 33528 for i386 I've tested compiling with Lazarus 1.7 trunk 52225 and with command line (with removed lpi). The result is the same. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] fpPDF UTF8 encoded PDFString
Hi, if I understand the documentation (https://partners.adobe.com/public/developer/en/pdf/PDFReference13.pdf) right, it should be possible to contain in the Latin Character Set in a PDF, also with fpPDF (which uses WinAnsiEncoding) and also with standard fonts. These characters are shown in table D.1 Latin Character Set and Encodings on page 551 of the documentation. If I now try to insert such characters, they aren't shown right in the created PDF (Adobe Reader XI, 64bit Windows 7, 32bit Lazarus 1.7 r52225 FPC 3.1.1 r33528 i386-win32-win32/win64). Simple try these steps to understand, what I mean: - open Example "testfppdf" and add Run Parameters "-p 1" to only create the first page. - add in the Source Editor in "testfppdf.lpr" line 139 some of the Latin Characters: P.WriteText(25, 20, 'Sample Text AÆÁÂÄÀÅÃBCÇDEÉÊËÈЀ'); - run your app and see the result (Adobe Reader XI, 64bit Windows 7): Sample Text A???BC?DE? If I convert the string to a UTF8-encoded one, the result is: Sample Text AÆÁÂÄÀÅÃBCÇDEÉÊËÈЀ (I also eliminated FtText1 := D.AddFont('FreeSans.ttf', 'FreeSans', clGreen); and the lines after line 139 to reduce the size of the attached PDFs, the result is the same) I add the two PDFs (one with ACP encoding, one with UTF-8 encoding) to show you the results. I also add "UTF8_Encoded_PDFString.patch" to show you, what I have done. I'm not sure, if this workaround is valid or there is a better solution. Please have a look at it. Thank you Kind regards Michl test_ACP.pdf Description: Adobe PDF document test_UTF8.pdf Description: Adobe PDF document Index: packages/fcl-pdf/src/fppdf.pp === --- packages/fcl-pdf/src/fppdf.pp (revision 33528) +++ packages/fcl-pdf/src/fppdf.pp (working copy) @@ -2380,6 +2380,7 @@ FValue := AValue; if (Pos('(', FValue) > 0) or (Pos(')', FValue) > 0) or (Pos('\', FValue) > 0) then FValue := InsertEscape(FValue); + SetCodePage(RawByteString(FValue), CP_UTF8, True); end; { TPDFUTF8String } -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] FLC-PDF and LazReport
Am 08.04.2016 um 23:40 schrieb Graeme Geldenhuys: I've written a PDF export filter, using fcl-pdf, for the fpReport (Free Pascal Reporting) project that will be released some time this year. fpReport still needs to bake a bit longer. ;-) There are more features coming in fpPDF too. Regards, - Graeme - Very interesting! Could you say something about fpReport? Is it a choice for LazReport or what is it for? Does it becomes part of FPC? Kind regards Michl -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] FLC-PDF and LazReport
Am 09.04.2016 um 02:08 schrieb Jesus Reyes A.: But if somebody is in a hurry and wants to jump in, please say so. I'm not really in hurry but it would be nice, not to ship all the dll (libcairo) with my app. I found some time and made some first tests. I successfully created a first basic TlrFpPdfExportFilter. I think it is doable, but it will take some time. I will ask here if I have questions. Thanks Kind regards Michl -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] FLC-PDF and LazReport
Hi, In a project I use LazReport and TlrCairoExport, cause I need implemented fonts and unicode support. Is there a plan to do it or anybody working on a wrapper for the new FPC PDF generator or is it even somehow possible today? Thank you Michl -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] PDF generator: please test
Am 08.04.2016 um 20:22 schrieb Michael Van Canneyt: Hello, Graeme has fixed a number of errors that should hopefully solve the problems with codepages; Changes have been tested on windows/linux/bsd but on Windows only with a system that has an english locale. These changes have been committed to FPC svn. (rev 33453) We would appreciate it if someone could test the PDF generating demo on a Windows with non-english locale, and report whether the first page of the generated PDF looks OK. Michael. I've tested it too. Thank you very much for your work! I've just copied the font FreeSans.ttf from Lazarus\components\aggpas to FPC\packages\fcl-pdf\examples\fonts. It looks fine (Windows 7, 64bit, Lazarus 1.7 r52149 FPC 3.1.1 r33453 i386-win32-win32/win64 German locale): (60mm,100mm) Times-BoldItalic: Big text at absolute position Languages: English: Hello, World! Greek: Γειά σου κόσμος Polish: Witaj świecie Portuguese: Olá mundo Russian: Здравствулте мир Vietnamese: Xin chào thế giới Box Drawing: ╠ ╣ ╦ ╩ ├ ┤ ┬ ┴ Typography: “What’s wrong?” £17.99 vs £17·99 €17.99 vs €17·99 OK then… êçèûÎÐð£¢ß B субботу двадцать третьего мая приезжает твоя любимая теща. As note: If I compile with -Cr, I got a Runerror 201 in unit fpparsettf on line 810. Kind regards Michl -- ___ 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] 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] Feature Request: Insert {codepage UTF8} per default
Am 30.03.2016 um 13:02 schrieb Juha Manninen: Conversions in your testproject may work, but you ignored the forum link I gave earlier. There "malcome" gave examples that fail. I don't ignored it, but I'm not so fast to test the examples there. I'll try the examples there for myself with and without the codepage definition. Thanks for that link. Am 30.03.2016 um 13:02 schrieb Juha Manninen: BTW, the hack is not made by LCL but by LazUtils which can be used also with cmd line / server programs. You are right. I only use LazUtils in combination with the component library, my mistake. Thanks for clearing this. Am 30.03.2016 um 13:02 schrieb Juha Manninen: I also don't want it. I want a added {$codepage UTF8}, if the file is saved as a UTF-8 encoded one. The cases fail with UTF-8 file encoding. I don't understand this. Am 30.03.2016 um 13:02 schrieb Juha Manninen: The issue with constant string encodings is more complex than you seem to understand. Thats true and I've made dozens of tests and spend a lot of time and try to help other people with it ... Am 30.03.2016 um 13:02 schrieb Juha Manninen: It is explained here somehow: http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus#String_Literals And the first example there is wrong (or the words "and without" need to be removed). With no defined codepage const s: string = 'äöü'; has codepoints of a UTF-8 String, the codepage is 0. If you assign it to a string with a declared codepage, you get a corrupted string. See my example. BTW I've forgotten ShortStrings in my example and maybe PChar. I'll add it (if possible) and try and report later. Thanks for your attention and time Kindly regards Michl -- ___ 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 30.03.2016 um 10:13 schrieb Juha Manninen: I don't know what is a a Predefined String Sorry, I was not clear. I mean a string with a declared codepage http://wiki.freepascal.org/FPC_Unicode_support#Declared_code_page -- ___ 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 30.03.2016 um 10:11 schrieb Mattias Gaertner: You have to distinguish between with CP_UTF8 as default and with CP_ACP as default. Yes, I know it. What I mean with default: Go to Project -> New Project ... -> Application Now a new Application is created. With the added patch {$codepage UTF8} is added and thats right, cause if you save the file to anywhere it is UTF-8 encoded. There is nothing wrong. Am 30.03.2016 um 10:11 schrieb Mattias Gaertner: Both have cases where some string combinations fail. With the hack that the LCL makes and the added {$codepage UTF8} all conversions work like a charm (see added testproject). If you want to use -dDisableUTF8RTL, you have to know, what you do. - remove {$codepage UTF8}, better set it to the valid codepage or use -FcCP... - save all the source files with the wanted encoding/codepage So IMHO this special case wouldn't be used much. All the puzzled discussions I can see in the forums are about the default applications created with Lazarus (not FPC), that uses the LCL. Am 30.03.2016 um 10:11 schrieb Mattias Gaertner: LCL applications nowadays use CP_UTF8 as default. We (laz team) tested adding -FcUTF8 and it failed in too many cases. Also it adds some overhead. So we decided to *not* add it by default. I also don't want it. I want a added {$codepage UTF8}, if the file is saved as a UTF-8 encoded one. Am 30.03.2016 um 10:11 schrieb Mattias Gaertner: Offtopic: In the added project: Why is a const 'abc' with {$codepage UTF8} a Unicodestring (Windows7, 64bit, Lazarus 1.7 r52077M FPC 3.1.1 i386-win32-win32/win64 on FPC 3.1.1 r33371)? There is no compile-time flag to tell the compiler what codepage the system is using at runtime. So it assumes current Windows codepage. Any string literal not in this codepage is stored as UTF-16. Thanks for that hint! -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Testing Rapberry Pi 3 performance
Sorry, my reply enters the wrong place. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Win API function calls with array as parameter
You can try: TileWindows(0, MDITILE_HORIZONTAL, Screen.WorkAreaRect, Length(MyHandles), MyHandles[0]); or TileWindows(0, MDITILE_HORIZONTAL, Screen.WorkAreaRect, High(MyHandles) + 1, MyHandles[0]); Simple Test works for me: uses ..., windows, LCLType; procedure TForm1.Button1Click(Sender: TObject); var Wnds: array[0..1] of HWND; begin Wnds[0] := Handle; Wnds[1] := Form2.Handle; TileWindows(0, MDITILE_HORIZONTAL, Screen.WorkAreaRect, Length(Wnds), Wnds[0]); end; -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] ScrollBox - How to get proper scrolling for a TPanel?
I've a similar problem, so I made a little test, but it is imho not the best solution (I have some flickering, but it works on Windows(7) ). You can use a own inherited TPanel and override its WndProc to send the message to its parent (TScrollBox): uses Classes, ExtCtrls, LMessages, Forms, Controls; type TMyPanel = class(TPanel) procedure WndProc(var TheMessage: TLMessage); override; end; ... procedure TMyPanel.WndProc(var TheMessage: TLMessage); var aControl: TControl; begin case TheMessage.Msg of LM_MOUSEWHEEL: begin aControl := Parent; if Assigned(aControl) then aControl.Perform(TheMessage.Msg, TheMessage.wParam, TheMessage.lParam); Exit; end; end; inherited WndProc(TheMessage); end; Am 06.01.2016 um 15:16 schrieb Gabor Boros: Hi All, I have a TScrollBox (Height=150) and a TPanel (Height=450) in it. With Linux-Qt I can scroll up and down if the mouse over the scrollbar, the empty space or the Panel in 13 steps. With Windows can scroll if over the scrollbar or the empty space (in 13 steps too). But the scroll not working if mouse over the Panel. I can override DoMouseWheel but down know how to get the 13 steps long scrolling from it. Any idea? (I use latest fixes_1_6.) Gabor -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] revision 51059 - lazbuild
I've tested your patch, it works for me (FPC 3.1.1 R32785, Lazarus R51073). In the bugtracker are four tickets about it as I wrote here: http://bugs.freepascal.org/view.php?id=29274 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Difference between Lazarus 1.4.2 and 1.5 of i18n
Am 20.09.2015 um 17:11 schrieb Mattias Gaertner: Someone broke the layout of the i18n frame of the project options. The checkbox was hidden below the bottom. I fixed it. Thank you, I've tested revision 49855 and it works fine now :) kind regards Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Difference between Lazarus 1.4.2 and 1.5 of i18n
Am 20.09.2015 um 14:22 schrieb Bart: On 9/20/15, Michael W. Vogel wrote: In Lazarus 1.4.2, ifIactivateintheproject optionsi18n,thecaptionsofthecontrolsare inserted intothe.po. Problems with space bar ;-) ? Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus ;) ;) ...no, I've copied a bing translated text, the rest was tipped (my english isn't the best) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Difference between Lazarus 1.4.2 and 1.5 of i18n
Hi, In Lazarus 1.4.2, ifIactivateintheproject optionsi18n,thecaptionsofthecontrolsare inserted intothe.po. If I do the same in Lazarus 1.5, only resourcestrings, not the captions are inserted. I checked the project.lpi and see following lines: If I remove LFM="False" then also the control captions are saved in the .po. So I think there is a new project option to activate / deactivate the saving of the captions into the .po, but I din't find such a option. Can you tell me, where to find this project option in Lazarus 1.5? If there isn't such a option, can you tell me, why LFM="False" is inserted in the project.lpi? I also asked in the German Lazarusforum with no answer till now: http://www.lazarusforum.de/viewtopic.php?f=19&t=9041 Thank you Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Initialization of an own component by "Save Project As ..."
Hi, I have a own component where I store a log filename with a relative path of my project. This works fine with a own property editor. There I open a TSaveDialog and remove the ProjectPath ( FProjectPath := ExtractFilePath(LazarusIDE.ActiveProject.MainFile.Filename); ) from the TSaveDialog.FileName. Now I have the problem, if I change the path of my project (Project -> Save Project As ...) the realative path is saved further in the component log filename (where a relative directory maybe not exists). Is there a way to detect this changing, so that I can automatically initialize my component? Thank youinadvance -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Processing TCoolBar child by IDE
I'm happy, that I can use Lazarus with its LCL :)) My request is more to see as a nice to have for the continuity of the Lazarus - RAD. Maybe you or someone else has to made some changes of that component, so this request can flow into it?! > BTW did you try TControlBar? Maybe it will suite you better. I've tried the TControlBar (thank you for that hint), but there are also some unwanted bevaviors (like moving a childcontrol upper to top of 0, moves the other controls down). I will see, what the better choice would be. Thank you, for sharing your component. Best regards Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Processing TCoolBar child by IDE
Hi, I have a question / feature request for a TCoolBar at designtime and Lazarus IDE. If I assign a control (e.g. TPanel) to a TCoolBar, a TCoolBand according to the dimensions of TPanels is created. Thats fine! If I change now the dimension of that control (at designtime), at runtime, the width of the TCoolBand got the width of the TCoolBand and the height got the height of the control. There are two features, what would be nice to have: If the height of a TCoolBand child control is changed, the IDE should show the identical height at designtime, like at runtime. If the width of a TCoolBand child control is changed, the width of the TCoolBand should also be changed. As a workaround, you can move the control from the TCoolBand to a other parent, delete the TCoolBand and move the control back to the TCoolBar. Then a TCoolBand with the correct dimensions is created. PS: I know, that the width can be changed by the user at runtime, so that a differentiation of designtime and runtime has to be made. Hope, you understand my poor English. Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus