Re: [Lazarus] Editor font disturbed after upgrading to r19705
Bart wrote: Is this a bug, or is there something wrong with my system? I can confirm the described behavior on my Windows 98 machine. But the problem seems to go deeper. If I put a Button on a Form, and double click the Button to let the IDE write the OnClick method, I get the error message: The component editor of class 'TDefaultComponentEditor' has created the error: 'Unable to find method. Please fix the error shown in the message window'. The class TForm1 is mixed then. See attached screen shot. Regards, Bernd. inline: ide.gif___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
On Fri, 01 May 2009 10:48:19 +0200 Bernd Mueller muelle...@gmx.net wrote: [...] The class TForm1 is mixed then. See attached screen shot. Sorry. My fault. I fixed that an hour ago in svn r19726. Mattias ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
Bart wrote: On 4/30/09, Martin Friebe laza...@mfriebe.de wrote: It looks to me like it uses a different font. certainly it looks like it believes the font was proportional (that is why you get the odd spacing, because SynEdit forces it into a grid). The last font-related changes in synedit where in revision 185xx (so before your last good revision). Maybe you could put some debugln into Synedit.SizeOrFontChanged and see which font is really used? Otherwise I have no idea. I can certainly do so, but in which unit is this method? I have attached a patch with a few debugln in it. I don't know if they will show anything useful, since I have no idea what is going on. If you apply it, you need to start lazarus with a logfile, to capture the output. (There is a command line switch, but I have to find it myself / I usually compile as none window app, which means my Lazarus runs with a console-window showing all the output) Also if you do this, test it with only one Synedit open. (You can compile a standalone app, with one SynEdit, and set the font from inside the app) I wrote a small test program that has a synmemo and a memo It sets the fonts of both the memo and synmemo the same and then queries their names etc and writes them in the editcontrols below (see attachments) In r18956 when setting the font (via fontdialog) to Courier New 10 point normal you see that the fonts look exactly the same in synmemo and memo (normal_couriernew.png). In r19705 they look very different indeed (bug_couriernew.png). Memos are native controls, so they are drawn differently. If you use the same font, (and in normal, bold, italic) for Labels and/or StaticText, does it look correct there? Note, the spacing will be ok there, because neither of them forces the mono-spacing. But does it actually look like the expected Courier New, and is it truly monospaced? So at least it looks like the synmemo thinks it's font is courier new... I haven't got Win9x, so I can't test. On XP it looks fine. I tested the compiled programs under XP and they behaved normally (and absolutely the same): the courier new font looks OK and the same in synmemo and memo. So we have a win9x specific bug? (Delphi with a tsynmemo and a tmemo behaves just fine on my win9x system) Bart Index: components/synedit/synedit.pp === --- components/synedit/synedit.pp (revision 19726) +++ components/synedit/synedit.pp (working copy) @@ -7529,6 +7529,7 @@ // TODO: Clear style only, if Highlighter uses styles Style := [];// Reserved for Highlighter end; + debugln(['RecalcCharExtend for font name=', Font.Name, ' / ', fFontDummy.Name, ' mono=',fFontDummy.IsMonoSpace, ' Handle=',fFontDummy.Handle]); with fTextDrawer do begin //debugln('TCustomSynEdit.RecalcCharExtent A UseUTF8=',dbgs(UseUTF8), // ' Font.CanUTF8='+dbgs(Font.CanUTF8)+' CharHeight=',dbgs(CharHeight)); Index: components/synedit/syntextdrawer.pp === --- components/synedit/syntextdrawer.pp (revision 19726) +++ components/synedit/syntextdrawer.pp (working copy) @@ -780,6 +780,10 @@ // clear styles SetStyle(Value.Style); end; +if pInfo nil then + debugln(['SetBasefont name=', Value.Name, ' basefont.name=', pInfo^.BaseFont.Name, ' Handle=',pInfo^.BaseFont.Handle]) +else + debugln(['SetBasefont name=', Value.Name, ' NO pinfo']); end else raise EheFontStockException.Create('SetBaseFont: ''Value'' must be specified.'); @@ -851,6 +855,7 @@ SelectObject(DC, hOldFont); {$ENDIF} InternalReleaseDC(DC); + debugln(['SetStyle created font for idx=',idx, ' name=',p^.Font.Name, ' handle=',p^.Handle]); end; procedure TheFontStock.UseFontHandles; ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
On 5/1/09, Martin Friebe laza...@mfriebe.de wrote: I have attached a patch with a few debugln in it. I don't know if they will show anything useful, since I have no idea what is going on. If you apply it, you need to start lazarus with a logfile, to capture the output. (There is a command line switch, but I have to find it myself / I usually compile as none window app, which means my Lazarus runs with a console-window showing all the output) Also if you do this, test it with only one Synedit open. (You can compile a standalone app, with one SynEdit, and set the font from inside the app) I applied the changes in sysnedit.pp and syneditextdrawer.pp then did a make clean all This happens when I build and start my test app. In OI the font is set to Verdanana, size -12 (height 16), pitch fpFixed F:\LazarusProjectentest SetStyle created font for idx=0 name=default handle=596 SetBasefont name=default basefont.name=default Handle=596 SetBasefont name=default NO pinfo SetStyle created font for idx=1 name=default handle=3364 RecalcCharExtend for font name=courier / courier mono=False Handle=2360 SetStyle created font for idx=0 name=courier handle=2360 SetBasefont name=courier basefont.name=courier Handle=2360 SetStyle created font for idx=1 name=courier handle=2492 RecalcCharExtend for font name=courier / courier mono=False Handle=2360 SetBasefont name=courier NO pinfo RecalcCharExtend for font name=courier / courier mono=False Handle=1760 SetStyle created font for idx=0 name=courier handle=1760 SetBasefont name=courier basefont.name=courier Handle=1760 RecalcCharExtend for font name=Verdana / Verdana mono=False Handle=1720 SetStyle created font for idx=0 name=Verdana handle=1720 SetBasefont name=Verdana basefont.name=Verdana Handle=1720 When I set the font (in my app) to Courier New, Normal, 10 pt, this is the output: RecalcCharExtend for font name=Courier New / Courier New mono=False Handle=2308 SetStyle created font for idx=0 name=Courier New handle=2308 SetBasefont name=Courier New basefont.name=Courier New Handle=2308 If I change the font in Lazarus IDE, I see no output on console, or on logfile (startlazarus --debug --pcp=bla) If you use the same font, (and in normal, bold, italic) for Labels and/or StaticText, does it look correct there? TLabel and TStaticText seems to work normally Note, the spacing will be ok there, because neither of them forces the mono-spacing. But does it actually look like the expected Courier New, and is it truly monospaced? Take a look at my attachments in my previous mail, to see for yourself The normal_couriernew is how Courier New should look on my system. Bart ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
On 5/1/09, Bernd Mueller muelle...@gmx.net wrote: Bart wrote: Is this a bug, or is there something wrong with my system? I can confirm the described behavior on my Windows 98 machine. What was your latest revision that seemed to be OK? (My latest was 18956, I hope yours is later...) That would help us finding where things went wrong. Bart ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] File region locking under Linux
I have a problem with file region locking under Linux. First I start setup to create a file and writelock range 10..30 -- program setup; {$mode delphi}{$H+} Usescthreads, Classes, SysUtils, BaseUnix; Const Fn = '/home/anthony/test_lock'; F_RDLCK = 0; F_WRLCK = 1; F_UNLCK = 2; Var F, I: Integer; Region : FLock; Begin If FileExists (Fn) Then DeleteFile (Fn); F := FpOpen (Fn, O_RDWR Or O_CREAT, $1B6); // $1B6 = o666 For I := 0 To 255 Do FpWrite (F, I, 1); // Populate file With Region Do // Set WriteLock 10..30 Begin l_type := F_WRLCK; l_whence := SEEK_SET; l_start := 10; l_len:= 20 End; If FpFcntl (F, F_SETLK, Region) = -1 Then WriteLn ('unable to apply writelock'); Sleep (2); // Sleep 20 Sec FpClose (F); End. -- Then within 20 seconds i start test to obtain a readlock on 80. This fails. Why? What am I doing wrong? -- program test; {$mode delphi}{$H+} Usescthreads, Classes, SysUtils, BaseUnix; Const Fn = '/home/anthony/test_lock'; F_RDLCK = 0; F_WRLCK = 1; F_UNLCK = 2; Var F, I: Integer; Region : FLock; Begin F := FpOpen (Fn, O_RDWR Or O_CREAT, $1B6); // $1B6 = o666 With Region Do // Set ReadLock on 80 Begin l_type := F_RDLCK; l_whence := SEEK_SET; l_start := 80; l_len:= 1 End; If FpFcntl (F, F_SETLK, Region) = -1 Then WriteLn ('unable to apply readlock on 80'); FpClose (F); End. Thanks ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
Bart wrote: On 5/1/09, Martin Friebe laza...@mfriebe.de wrote: I have attached a patch with a few debugln in it. I don't know if they will show anything useful, since I have no idea what is going on. If you apply it, you need to start lazarus with a logfile, to capture the output. (There is a command line switch, but I have to find it myself / I usually compile as none window app, which means my Lazarus runs with a console-window showing all the output) Also if you do this, test it with only one Synedit open. (You can compile a standalone app, with one SynEdit, and set the font from inside the app) I applied the changes in sysnedit.pp and syneditextdrawer.pp then did a make clean all This happens when I build and start my test app. Does that test app use a syntax highlighter? From the output I would guess that it does not. (because the font is only recalculated in plain, but not in bold or italic / You compare app with memo in your 2nd mail shows plain style only.) Anyway, as long as it doesn't, the output looks good. One thing I noted in the pictures of your first mail (highlighted pascal before/after): In the after text the output of the bold text seems to use a different font than plain text. Compare the u. The plain u (and any u in the before pic) has serif/serif-like extensions. the bold u in the after pic, has not. Regards the output below: the default and courier are normal, SynEdit creates them during it's own creation, before you even have a chance to set the font. In OI the font is set to Verdanana, size -12 (height 16), pitch fpFixed F:\LazarusProjectentest SetStyle created font for idx=0 name=default handle=596 SetBasefont name=default basefont.name=default Handle=596 SetBasefont name=default NO pinfo SetStyle created font for idx=1 name=default handle=3364 RecalcCharExtend for font name=courier / courier mono=False Handle=2360 SetStyle created font for idx=0 name=courier handle=2360 SetBasefont name=courier basefont.name=courier Handle=2360 SetStyle created font for idx=1 name=courier handle=2492 RecalcCharExtend for font name=courier / courier mono=False Handle=2360 SetBasefont name=courier NO pinfo RecalcCharExtend for font name=courier / courier mono=False Handle=1760 SetStyle created font for idx=0 name=courier handle=1760 SetBasefont name=courier basefont.name=courier Handle=1760 Here you would have set Verdana RecalcCharExtend for font name=Verdana / Verdana mono=False Handle=1720 SetStyle created font for idx=0 name=Verdana handle=1720 idx=0 = plain, no-bold, no-italic SetBasefont name=Verdana basefont.name=Verdana Handle=1720 When I set the font (in my app) to Courier New, Normal, 10 pt, this is the output: RecalcCharExtend for font name=Courier New / Courier New mono=False Handle=2308 SetStyle created font for idx=0 name=Courier New handle=2308 SetBasefont name=Courier New basefont.name=Courier New Handle=2308 If I change the font in Lazarus IDE, I see no output on console, or on logfile (startlazarus --debug --pcp=bla) If you use the same font, (and in normal, bold, italic) for Labels and/or StaticText, does it look correct there? TLabel and TStaticText seems to work normally The best is probably to try and find the revision which broke it. Everything else is just blind search for a needle in a hay stack. But in case, what happens with labels/statictext, if you set pitch to variable/fixed? Martin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] File region locking under Linux
On Fri, 01 May 2009 17:10:09 +0200 ajv a...@vogelaar-electronics.com wrote: I have a problem with file region locking under Linux. First I start setup to create a file and writelock range 10..30 Wrong list. This question is better asked on the FPC mailing list. Mattias ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
Martin Friebe wrote: The best is probably to try and find the revision which broke it. Everything else is just blind search for a needle in a hay stack. r19131 is the breaking revision. Regards, Bernd. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
Bernd Mueller wrote: Martin Friebe wrote: The best is probably to try and find the revision which broke it. Everything else is just blind search for a needle in a hay stack. r19131 is the breaking revision. Oh... my revision. I will try to test on win98 tomorow. Best regards, Paul Ishenin. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
Bernd Mueller wrote: Martin Friebe wrote: The best is probably to try and find the revision which broke it. Everything else is just blind search for a needle in a hay stack. r19131 is the breaking revision. Please test with r19746. Best regards, Paul Ishenin. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Need help about printer Custom Size
I need to print on a non standard size paper and this should be done directly from the application without the printersetupdialog. How to set the new size? Any help will be appreciate Salvatore ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TFont.Orientation
Hello, I added this property. I verifyed that it works in Carbon and I implemented it for Qt. It should obviously work for win32/wince and also for gtk2. From the major platforms, only gtk1 should not support it. -- Felipe Monteiro de Carvalho ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TFont.size
Hello, Does anyone the difference between TFont.Height and TFont.Size? It seams to me that Height is measured in pixels and Size is some other unit which I don't know. Even worse, it doesn't seam to be an international system unit, but rather an american unit (some fraction of inches). The Delphi docs say: Use Size to specify the point size of the font. If the value is negative, the internal leading that appears at the top of each line of text is included. If the value is positive, Size represents the height of the characters but not the internal leading. To determine the size of the font in pixels, use the Height property instead. The value of Size can be obtained from the height in pixels using this formula: Copy Code Font.Size = -Font.Height * 72 / Font.PixelsPerInch When the Size property has a positive value, the Height property has a negative value. When the Height property has a positive value, the Size property has a negative value. A rather exoteric property IMHO. Or yet another Windowsism in Delphi -- Felipe Monteiro de Carvalho ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TFont.Name best practices
Hello, Which guidelines do you use to choose TFont.Name? Specially because you either distribute the font with the application or you have no guarantee it will exists in the system in the chaotic universte of cross-platform development. Different libraries have different policies about choosing the correct font if the desired one isn't present. Qt docs say that it will try to choose the best font using some kind of the logic on the name. Windows docs say nothing, so I guess it just falls to default, unless TFont.Pitch was assigned, when it tryes to find some characteristics. Any ideas about Carbon? Gtk2 should also try some logic I think ... The problem is that with this differences it gets very hard to get guidelines about how to use this property. Maybe suppose the worse case, if unavailable it will follow to default? thanks, -- Felipe Monteiro de Carvalho ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Editor font disturbed after upgrading to r19705
On 5/1/09, Paul Ishenin webpi...@mail.ru wrote: Bernd Mueller wrote: Martin Friebe wrote: The best is probably to try and find the revision which broke it. Everything else is just blind search for a needle in a hay stack. r19131 is the breaking revision. Please test with r19746. Best regards, Paul Ishenin. I updated to r19751: this looks OK again! Thanks very much for the swift fix. (The IDE was almost unusable ...) Every now and then I'm forced to use D3, and I've gotten so used to Lazarus I'd really rather not have to go back. Bart ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TFont.size
On Fri, 1 May 2009 17:35:19 -0300 Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: Hello, Does anyone the difference between TFont.Height and TFont.Size? ... A rather exoteric property IMHO. Or yet another Windowsism in Delphi Not so much a Windowsism as baggage from the days before screens when 'printing' was never to a screen but only a process that transferred ink from hand set lead typeface to paper. Traditionally type sizes were measured in printer points, defined as 1/72 inch as measured by the EM square of the font. The EM square is the size of the lead block that would enclose a capital letter M (the block is fractionally bigger than the actual printed size of the M). The two different properties Delphi provides to set the size of a font relate to the two possible expressions of the font: printing to paper and 'printing' to the screen. If you specify the font's size using the Font.Size property, the font is scaled to match the size you specify in printer points. If you specify the font's size using the Font.Height property, the font is scaled in pixels. If you specify the Height as a positive value, the font's external leading is included in the calculation. If you specify a negative value, the font's external leading is not included in the calculation. (Traditionally leading, pronounced like the metal lead, means the line spacing, dating from the time when thin strips of lead were placed between lines of type to increase the space between lines). Howard ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] TFont.size
--- El vie 1-may-09, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com escribió: It seams to me that Height is measured in pixels and Size is some other unit which I don't know. Even worse, it doesn't seam to be an international system unit, but rather an american unit (some fraction of inches). Points, where 1 Point = 1/72 inch. Why using points instead of just pixels?, it's convenient because you can forget about resolution, for example one might want to show some text on screen, maybe 20 pixels height would look nice for a big title, but that is so because screen resolution is perhaps 96 pixels per inch, but what happen when the text is printed on a 1200 dpi printer? it will probably do not stand out, so without points one would need a way to specify pixel heights for several resolutions. So a good property of points is that they are independent of resolution. Jesus Reyes A. ¡Obtén la mejor experiencia en la web! Descarga gratis el nuevo Internet Explorer 8. http://downloads.yahoo.com/ieak8/?l=mx ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus