Re: [lazarus] Carbon Widgetset: character spacing problems
Phil wrote: There's probably quite a lot going on here. Tomas is actually passing a total of 8 options, including options to turn off kerning, to use rounded text metrics instead of fractional, and others, as well as disabling fractional spacing in the rendering of the line. Hi Phil, could you find out which of these options are actually needed? I think the combination of so many disable-options may cause the problem. Currently, the text is simply displayed in a very bad and a very wrong way. It is almost unreadable. Please look at it again: http://www.superflexible.com/characterspacing.png Cheers, Tobias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 03 Nov 2007 18:11:51 +0100 Tobias Giesen [EMAIL PROTECTED] wrote: Hello, I am trying to figure out how to get the best font for dialog items. The best I can get is shown on the following screenshot: http://www.superflexible.com/characterspacing.png The text in the button is fine, this seems to be the default Mac OS look. I want to use the same font for the TLabel too. But it looks different and there are spacing problems: between many characters, there is a strange extra space (for example, between i and s in the first word). I am using the latest Lazarus SVN. What needs to be done to make this look nicer? Fix TCarbonDeviceContext.ExtTextOut. The image looks as if it draws a proportional font monospaced. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
Fix TCarbonDeviceContext.ExtTextOut. The image looks as if it draws a proportional font monospaced. OK the problem is caused by TCarbonDeviceContext.BeginTextRender. In my opinion, the lines following the comment // disable fractional positions up to the next comment should be removed. I don't know what the original intention was. My app uses various different controls and they all look nicer without these lines. Opinions? Cheers, Tobias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 03 Nov 2007 19:34:30 +0100 Tobias Giesen [EMAIL PROTECTED] wrote: Fix TCarbonDeviceContext.ExtTextOut. The image looks as if it draws a proportional font monospaced. OK the problem is caused by TCarbonDeviceContext.BeginTextRender. In my opinion, the lines following the comment // disable fractional positions up to the next comment should be removed. I don't know what the original intention was. My app uses various different controls and they all look nicer without these lines. Opinions? SynEdit needs disabled fractional positions. It sets DXnil. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
SynEdit needs disabled fractional positions. It sets DXnil. So, can you add some kind of condition so that they are only disabled when necessary? The collateral damage seems to be considerable. Kind Regards, Tobias Giesen www.superflexible.com _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 03 Nov 2007 20:14:02 +0100 Tobias Giesen [EMAIL PROTECTED] wrote: SynEdit needs disabled fractional positions. It sets DXnil. So, can you add some kind of condition so that they are only disabled when necessary? The collateral damage seems to be considerable. I have no carbon at the moment to test. Have you tried if DXnil then enable... else disable... ? Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
SynEdit needs disabled fractional positions. It sets DXnil. Have you tried if DXnil then Hello, thanks, that works for me! I am attaching a proposed patch. Kind Regards, Tobias Giesen www.superflexible.com www.tgtools.com carboncanvas-tg-2007-11-03.patch Description: Binary data
RE: [lazarus] Carbon Widgetset: character spacing problems
SynEdit is not the only custom control that was fixed by the change to BeginTextRender that disabled the fractional positioning of characters. This was an important fix since proportional font characters do not have whole number widths, yet they can only be displayed on a device using whole pixels. Without disabling this, then width(char) x number of chars in string width(string), which is what was causing the problem in SynEdit (and any other text editor type custom controls). Note that all char and string width functions return a whole number, so individual char widths get rounded. Tobias, what fonts are you using? Could you post your example app. I'm not seeing the char positioning differences here. Please be careful making any changes to this. I believe Canvas.OutText calls ExtTextOut with DX=nil so the suggested workaround may break some other things that were fixed with the BeginTextRender change. Thanks. -Phil -Original Message- From: Mattias Gaertner [mailto:[EMAIL PROTECTED] Sent: Sat 11/3/2007 2:19 PM To: lazarus@miraclec.com Subject: Re: [lazarus] Carbon Widgetset: character spacing problems On Sat, 03 Nov 2007 20:14:02 +0100 Tobias Giesen [EMAIL PROTECTED] wrote: SynEdit needs disabled fractional positions. It sets DXnil. So, can you add some kind of condition so that they are only disabled when necessary? The collateral damage seems to be considerable. I have no carbon at the moment to test. Have you tried if DXnil then enable... else disable... ? Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives winmail.dat
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 03 Nov 2007 20:57:28 +0100 Tobias Giesen [EMAIL PROTECTED] wrote: SynEdit needs disabled fractional positions. It sets DXnil. Have you tried if DXnil then Hello, thanks, that works for me! I am attaching a proposed patch. Thanks. Applied. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 3 Nov 2007 16:09:16 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: SynEdit is not the only custom control that was fixed by the change to BeginTextRender that disabled the fractional positioning of characters. This was an important fix since proportional font characters do not have whole number widths, yet they can only be displayed on a device using whole pixels. Without disabling this, then width(char) x number of chars in string width(string), which is what was causing the problem in SynEdit (and any other text editor type custom controls). Note that all char and string width functions return a whole number, so individual char widths get rounded. AFAIK only synedit needs monospace fonts. What other text editor's do you mean? Tobias, what fonts are you using? Could you post your example app. I'm not seeing the char positioning differences here. Please be careful making any changes to this. I believe Canvas.OutText calls ExtTextOut with DX=nil so the suggested workaround may break some other things that were fixed with the BeginTextRender change. Yes, afaik only SynEdit fills DX. All others don't use it. If DXnil every character is placed at a custom position. With DX=nil the widgetset should paint the text normal. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
Hi Phil, my test program is just a label and a button. I have not made ANY font specifications. The button shows the text correctly, while the label does not. You just need to type text long enough so that you see it. There must be some way for a control to specify if it needs to have the Fractional Positioning disabled or not. Maybe the font properties could specify if it is a fixed width font or a proportional font? I have recompiled the LCL with my patch, and at least TEdit continues to work normally. In a normal app with normal controls, fractional positioning seems to be badly needed. Kind Regards, Tobias Giesen Super Flexible Software Ltd. Co. KG Lessingstr. 42 48485 Neuenkirchen, Germany www.superflexible.com www.tgtools.com --- Registered at register court Steinfurt as HRA 5061 Liability / general partner: TGTools Ltd. Company No. 05513299 Registered in England and Wales Directors: Tobias Giesen and Claudia Hübl _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] Carbon Widgetset: character spacing problems
As I feared, your fix busted my custom control. Please revert the change until a better solution is arrived at. Please don't assume that the LCL is the entire universe. I'm porting a large custom control that had character positioning problems on Carbon (other widgetsets were fine) until Tomas fixed BeginTextRender. Now it's broken again for me. Thanks. -Phil -Original Message- From: Mattias Gaertner [mailto:[EMAIL PROTECTED] Sent: Sat 11/3/2007 3:24 PM To: lazarus@miraclec.com Subject: Re: [lazarus] Carbon Widgetset: character spacing problems On Sat, 3 Nov 2007 16:09:16 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: SynEdit is not the only custom control that was fixed by the change to BeginTextRender that disabled the fractional positioning of characters. This was an important fix since proportional font characters do not have whole number widths, yet they can only be displayed on a device using whole pixels. Without disabling this, then width(char) x number of chars in string width(string), which is what was causing the problem in SynEdit (and any other text editor type custom controls). Note that all char and string width functions return a whole number, so individual char widths get rounded. AFAIK only synedit needs monospace fonts. What other text editor's do you mean? Tobias, what fonts are you using? Could you post your example app. I'm not seeing the char positioning differences here. Please be careful making any changes to this. I believe Canvas.OutText calls ExtTextOut with DX=nil so the suggested workaround may break some other things that were fixed with the BeginTextRender change. Yes, afaik only SynEdit fills DX. All others don't use it. If DXnil every character is placed at a custom position. With DX=nil the widgetset should paint the text normal. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives winmail.dat
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 3 Nov 2007 16:40:38 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: As I feared, your fix busted my custom control. Please revert the change until a better solution is arrived at. Please don't assume that the LCL is the entire universe. SynEdit is not part of the LCL and Canvas.TextOut is a quite important function. It should not print a proportional font monospaced. I'm porting a large custom control that had character positioning problems on Carbon (other widgetsets were fine) until Tomas fixed BeginTextRender. Now it's broken again for me. I undid the change, although I'm not sure why you need proportional fonts printed monospaced. Mattias Thanks. -Phil -Original Message- From: Mattias Gaertner [mailto:[EMAIL PROTECTED] Sent: Sat 11/3/2007 3:24 PM To: lazarus@miraclec.com Subject: Re: [lazarus] Carbon Widgetset: character spacing problems On Sat, 3 Nov 2007 16:09:16 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: SynEdit is not the only custom control that was fixed by the change to BeginTextRender that disabled the fractional positioning of characters. This was an important fix since proportional font characters do not have whole number widths, yet they can only be displayed on a device using whole pixels. Without disabling this, then width(char) x number of chars in string width(string), which is what was causing the problem in SynEdit (and any other text editor type custom controls). Note that all char and string width functions return a whole number, so individual char widths get rounded. AFAIK only synedit needs monospace fonts. What other text editor's do you mean? Tobias, what fonts are you using? Could you post your example app. I'm not seeing the char positioning differences here. Please be careful making any changes to this. I believe Canvas.OutText calls ExtTextOut with DX=nil so the suggested workaround may break some other things that were fixed with the BeginTextRender change. Yes, afaik only SynEdit fills DX. All others don't use it. If DXnil every character is placed at a custom position. With DX=nil the widgetset should paint the text normal. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
I'm porting a large custom control that had character positioning problems on Carbon (other widgetsets were fine) until Tomas fixed BeginTextRender. You mean, until he broke BeginTextRender. The general functionality of BeginTextRender was broken in favor of one or two custom controls. This needs to be re-done properly. Kind Regards, Tobias Giesen Super Flexible Software Ltd. Co. KG Lessingstr. 42 48485 Neuenkirchen, Germany www.superflexible.com www.tgtools.com --- Registered at register court Steinfurt as HRA 5061 Liability / general partner: TGTools Ltd. Company No. 05513299 Registered in England and Wales Directors: Tobias Giesen and Claudia Hübl _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] Carbon Widgetset: character spacing problems
Tobias, I believe I can live with the patch by doing some conditional compiling on my end (note this is not needed with other widgetsets but will with Carbon if the patch is made). However, I'll need two additional changes. In TCarbonDeviceContext.GetTextExtentPoint and TCarbonDeviceContext.GetTextMetrics, please pass True in BeginTextRender instead of False and test to see if that has any undesirable consequences. I recompiled the IDE with this changes as well as my TLabel test app and I don't see any problems on this end. ExtTextOut and GetTextExtentPoint are often used hand in hand, so disabling fractional spacing with non-nil DX means that it should also be disabled in GetTextExtentPoint. However, there's no way to pass this information to GetTextExtentPoint the way there is with ExtTextOut. Thanks. -Phil -Original Message- From: Tobias Giesen [mailto:[EMAIL PROTECTED] Sent: Sat 11/3/2007 4:24 PM To: lazarus@miraclec.com Subject: Re: [lazarus] Carbon Widgetset: character spacing problems I'm porting a large custom control that had character positioning problems on Carbon (other widgetsets were fine) until Tomas fixed BeginTextRender. You mean, until he broke BeginTextRender. The general functionality of BeginTextRender was broken in favor of one or two custom controls. This needs to be re-done properly. Kind Regards, Tobias Giesen Super Flexible Software Ltd. Co. KG Lessingstr. 42 48485 Neuenkirchen, Germany www.superflexible.com www.tgtools.com --- Registered at register court Steinfurt as HRA 5061 Liability / general partner: TGTools Ltd. Company No. 05513299 Registered in England and Wales Directors: Tobias Giesen and Claudia Hübl _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives winmail.dat
Re: [lazarus] Carbon Widgetset: character spacing problems
Phil wrote: As I feared, your fix busted my custom control. Please revert the change until a better solution is arrived at. Please make a suggestion on how your custom control can let the ExtTextOut function know that it cannot handle fractional positions. I think you need to help with this. Cheers, Tobias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] Carbon Widgetset: character spacing problems
Hi Mattias, I don't believe the issue is one of proportional fonts using monospaced font character spacing. Monospaced fonts use the same width for all chars. Disabling fractional positioning of the char glyphs means treating each char's width as a whole number. For example, if the period (.) has a width of 3.3, I believe this means treat it as having a width of 4. Thanks. -Phil -Original Message- From: Mattias Gaertner [mailto:[EMAIL PROTECTED] Sent: Sat 11/3/2007 4:00 PM To: lazarus@miraclec.com Subject: Re: [lazarus] Carbon Widgetset: character spacing problems On Sat, 3 Nov 2007 16:40:38 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: As I feared, your fix busted my custom control. Please revert the change until a better solution is arrived at. Please don't assume that the LCL is the entire universe. SynEdit is not part of the LCL and Canvas.TextOut is a quite important function. It should not print a proportional font monospaced. I'm porting a large custom control that had character positioning problems on Carbon (other widgetsets were fine) until Tomas fixed BeginTextRender. Now it's broken again for me. I undid the change, although I'm not sure why you need proportional fonts printed monospaced. Mattias Thanks. -Phil -Original Message- From: Mattias Gaertner [mailto:[EMAIL PROTECTED] Sent: Sat 11/3/2007 3:24 PM To: lazarus@miraclec.com Subject: Re: [lazarus] Carbon Widgetset: character spacing problems On Sat, 3 Nov 2007 16:09:16 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: SynEdit is not the only custom control that was fixed by the change to BeginTextRender that disabled the fractional positioning of characters. This was an important fix since proportional font characters do not have whole number widths, yet they can only be displayed on a device using whole pixels. Without disabling this, then width(char) x number of chars in string width(string), which is what was causing the problem in SynEdit (and any other text editor type custom controls). Note that all char and string width functions return a whole number, so individual char widths get rounded. AFAIK only synedit needs monospace fonts. What other text editor's do you mean? Tobias, what fonts are you using? Could you post your example app. I'm not seeing the char positioning differences here. Please be careful making any changes to this. I believe Canvas.OutText calls ExtTextOut with DX=nil so the suggested workaround may break some other things that were fixed with the BeginTextRender change. Yes, afaik only SynEdit fills DX. All others don't use it. If DXnil every character is placed at a custom position. With DX=nil the widgetset should paint the text normal. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives winmail.dat
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 3 Nov 2007 18:21:49 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: Tobias, I believe I can live with the patch by doing some conditional compiling on my end (note this is not needed with other widgetsets but will with Carbon if the patch is made). However, I'll need two additional changes. In TCarbonDeviceContext.GetTextExtentPoint and TCarbonDeviceContext.GetTextMetrics, please pass True in BeginTextRender instead of False and test to see if that has any undesirable consequences. I recompiled the IDE with this changes as well as my TLabel test app and I don't see any problems on this end. ExtTextOut and GetTextExtentPoint are often used hand in hand, so disabling fractional spacing with non-nil DX means that it should also be disabled in GetTextExtentPoint. However, there's no way to pass this information to GetTextExtentPoint the way there is with ExtTextOut. Providing a DX to ExtTextOut means overriding any normal widths. That's why GetTextExtentPoint and GetTextExtentExPoint have no DX parameter. In other words: GetTextExtentPoint makes only sense if DX=nil in ExtTextOut. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 03 Nov 2007 22:24:32 +0100 Tobias Giesen [EMAIL PROTECTED] wrote: I'm porting a large custom control that had character positioning problems on Carbon (other widgetsets were fine) until Tomas fixed BeginTextRender. You mean, until he broke BeginTextRender. The general functionality of BeginTextRender was broken in favor of one or two custom controls. This needs to be re-done properly. I just tested under intel/MacOSX/Leopard: TLabel looks ok. No monospace kerning. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Carbon Widgetset: character spacing problems
On Sat, 3 Nov 2007 18:58:01 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: Hi Mattias, I don't believe the issue is one of proportional fonts using monospaced font character spacing. Monospaced fonts use the same width for all chars. Disabling fractional positioning of the char glyphs means treating each char's width as a whole number. For example, if the period (.) has a width of 3.3, I believe this means treat it as having a width of 4. Yes, I understand the apple help the same, but the screenshot problems seems to be a bigger problem than just rounding one pixel. But maybe this is a carbon problem in general when disabling fractions. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] Carbon Widgetset: character spacing problems
Hi Mattias, Not sure if I follow your reasoning. In Windows, the ExtTextOut Dx param means use these character widths (in array pointed to by Dx) instead of the default character widths. Since Dx is otherwise ignored in the Carbon widgetset you're just using the Dx param as a switch. If Dx is nil, it means use fractional char widths; if non-nil it means don't use fractional char widths. Neither of these is consistent with how Dx is supposed to function. Who's to say what normal character spacing should be? Tobias might suggest that it should be as close as possible to the way OS X currently renders buttons. I might suggest that it should be as close as possible to the way Windows renders text (as in Write once compile anywhere). There's probably quite a lot going on here. Tomas is actually passing a total of 8 options, including options to turn off kerning, to use rounded text metrics instead of fractional, and others, as well as disabling fractional spacing in the rendering of the line. Thanks. -Phil -Original Message- From: Mattias Gaertner [mailto:[EMAIL PROTECTED] Sent: Sat 11/3/2007 6:05 PM To: lazarus@miraclec.com Subject: Re: [lazarus] Carbon Widgetset: character spacing problems On Sat, 3 Nov 2007 18:21:49 -0400 Hess, Philip J [EMAIL PROTECTED] wrote: Tobias, I believe I can live with the patch by doing some conditional compiling on my end (note this is not needed with other widgetsets but will with Carbon if the patch is made). However, I'll need two additional changes. In TCarbonDeviceContext.GetTextExtentPoint and TCarbonDeviceContext.GetTextMetrics, please pass True in BeginTextRender instead of False and test to see if that has any undesirable consequences. I recompiled the IDE with this changes as well as my TLabel test app and I don't see any problems on this end. ExtTextOut and GetTextExtentPoint are often used hand in hand, so disabling fractional spacing with non-nil DX means that it should also be disabled in GetTextExtentPoint. However, there's no way to pass this information to GetTextExtentPoint the way there is with ExtTextOut. Providing a DX to ExtTextOut means overriding any normal widths. That's why GetTextExtentPoint and GetTextExtentExPoint have no DX parameter. In other words: GetTextExtentPoint makes only sense if DX=nil in ExtTextOut. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives winmail.dat