Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-01

Typo in TFPCustomFont?

19 messages · 9 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

packages/fcl-image/src/fpcanvas.pp in FPC 2.6 (didn't yet check trunk) has:

  TFPCustomFont = class (TFPCanvasHelper)
  public
    property StrikeTrough : boolean index 8 read GetFlags write SetFlags;
  end;

Googling seams to indicate the correct should be "StrikeThrough", but I'm not that great in english spelling, sometimes there is a american and english variant, etc, so maybe someone could confirm what is the correct? StrikeThrough or StrikeTrough?

And if it is really a typo, can I fix it even breaking compatibility?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Michael Van Canneyt
to Felipe Monteiro de Carvalho: packages/fcl-image/src/fpcanvas.pp in FPC 2.6 (didn't yet check trunk) has: TFPCustomFont…
Felipe Monteiro de Carvalho wrote 13 lines
Hello, packages/fcl-image/src/fpcanvas.pp in FPC 2.6 (didn't yet check trunk) has: TFPCustomFont = class (TFPCanvasHelper) public property StrikeTrough : boolean index 8 read GetFlags write SetFlags; end; Googling seams to indicate the correct should be "StrikeThrough", but I'm not that great in english spelling, sometimes there is a american and english variant, etc, so maybe someone could confirm what is the correct? StrikeThrough or StrikeTrough?

It is a typo.

And if it is really a typo, can I fix it even breaking compatibility?

Fix it.

Michael.

Reply by email

Martin
to Marco van de Voort
Marco van de Voort wrote 10 lines
On Mon, Jan 14, 2013 at 12:00:43PM +0100, Michael Van Canneyt wrote: >> correct? StrikeThrough or StrikeTrough? > It is a typo. > >> And if it is really a typo, can I fix it even breaking compatibility? > Fix it. ... and merge it back to 2.6.2 ? :-) IMHO: yes.

Maybe make the old one deprecated in fixes, while adding the new.

Reply by email

Mattias Gaertner
to Martin
Show quoted text 13 lines
On 16/01/2013 14:25, Marco van de Voort wrote: > On Mon, Jan 14, 2013 at 12:00:43PM +0100, Michael Van Canneyt wrote: >>> correct? StrikeThrough or StrikeTrough? >> It is a typo. >> >>> And if it is really a typo, can I fix it even breaking compatibility? >> Fix it. > ... and merge it back to 2.6.2 ? :-) > > IMHO: yes. > Maybe make the old one deprecated in fixes, while adding the new.

IMO do not add "deprecated" without a proper alternative.

Mattias

Reply by email

Reinier Olislagers
to Felipe Monteiro de Carvalho: I fixed the spelling error in rev 23411 without deprecated Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
I fixed the spelling error in rev 23411 without deprecated

Perhaps the attached patch could be applied to fix the Lazarus issue described in mantis 23675: The strikethrough fix should also be in upstream.

Haven't checked with 2.6.0 or earlier, but Lazarus compiles correctly with trunk.

Alternatively/additionally, perhaps trunk could be fixed like 2.6.2 was
using deprecated - so existing code wouldn't break:
-    property StrikeTrough : boolean index 8 read GetFlags write SetFlags;
+    property StrikeTrough : boolean  index 8 read GetFlags write
SetFlags; deprecated;
+    property StrikeThrough : boolean index 8 read GetFlags write SetFlags;

thanks,
Reinier
-------------- next part --------------
Index: components/fpvectorial/fpvectorial.pas
=================================================================== --- components/fpvectorial/fpvectorial.pas (revision 39878) +++ components/fpvectorial/fpvectorial.pas (working copy) @@ -1198,7 +1198,12 @@

   ADest.Font.Bold := Font.Bold;
   ADest.Font.Italic := Font.Italic;
   ADest.Font.Underline := Font.Underline;

- //ADest.Font.StrikeThrough := Font.StrikeThrough; uncomment when FPC 2.6.2+ only is supported
+ {$IF FPC_FULLVERSION>=20602} //changed in 2.6.2 and 2.7; remove when FPC 2.6.2+ only is supported
+ ADest.Font.StrikeThrough := Font.StrikeThrough;
+ {$ELSE}
+ ADest.Font.StrikeTrough := Font.StrikeTrough; //old version with typo
+ {$END}
+

   {$ifdef USE_LCL_CANVAS}
   ALCLDest.Font.Orientation := Round(Font.Orientation * 16);
   {$endif}

Index: components/aggpas/src/agg_fpimage.pas
=================================================================== --- components/aggpas/src/agg_fpimage.pas (revision 39878) +++ components/aggpas/src/agg_fpimage.pas (working copy) @@ -382,7 +382,11 @@

     property Bold; // only windows
     property Italic; // only windows
     property Underline; // not supported

- //property StrikeThrough; // not supported, uncomment when FPC 2.6.2+ only is supported
+ {$IF FPC_FULLVERSION>=20602} //changed in 2.6.2 and 2.7; remove when FPC 2.6.2+ only is supported
+ property StrikeThrough;
+ {$ELSE}
+ property StrikeTrough; //old version with typo
+ {$END}

   end;

{ TAggFPPath }
Index: lcl/interfaces/customdrawn/customdrawnwinapi.inc =================================================================== --- lcl/interfaces/customdrawn/customdrawnwinapi.inc (revision 39878) +++ lcl/interfaces/customdrawn/customdrawnwinapi.inc (working copy) @@ -4090,7 +4090,11 @@

   TM.tmBreakChar := '?';
   TM.tmItalic := Ord(lFont.Italic);
   TM.tmUnderlined := Ord(lFont.Underline);

- //TM.tmStruckOut := Ord(lFont.StrikeThrough); uncomment when FPC 2.6.2+ only is supported
+ {$IF FPC_FULLVERSION>=20602} //changed in 2.6.2 and 2.7; remove when FPC 2.6.2+ only is supported
+ TM.tmStruckOut := Ord(lFont.StrikeThrough);
+ {$ELSE}
+ TM.tmStruckOut := Ord(lFont.StrikeTrough); //old version with typo
+ {$END}

{ Defaults to a TrueType font.
Note that the meaning of the FIXED_PITCH constant is the opposite of Index: lcl/lazcanvas.pas
=================================================================== --- lcl/lazcanvas.pas (revision 39878)
+++ lcl/lazcanvas.pas (working copy)
@@ -761,7 +761,11 @@

   Font.Bold := AFont.Bold;
   Font.Italic := AFont.Italic;
   Font.Underline := AFont.Underline;

- //Font.StrikeThrough := AFont.StrikeThrough; uncomment when FPC 2.6.2+ only is supported
+ {$IF FPC_FULLVERSION>=20602} //changed in 2.6.2 and 2.7; remove when FPC 2.6.2+ only is supported
+ Font.StrikeThrough := AFont.StrikeThrough;
+ {$ELSE}
+ Font.StrikeTrough := AFont.StrikeTrough; //old version with typo
+ {$ENDIF}
end;

{ TFPWindowsSharpInterpolation }

Reply by email

Reinier Olislagers
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
The patch looks good, but should it be FPC_FULLVERSION>=20601 ? Or else with fixes it might not work.

Yes you're right. I suppose I'm anticipating the release of 2.6.2...

Given the fact that fixes 2.6 has both the typo and non-typo version, in practice the patch should work on fixes 2.6 as is... the patch mainly solves problems with 2.6.0...

Reply by email

Reinier Olislagers
to Marco van de Voort: Done to fixes. (which will be branched for 2.6.2)
Marco van de Voort wrote 8 lines
On Wed, Jan 16, 2013 at 02:35:07PM +0000, Martin wrote: >> ... and merge it back to 2.6.2 ? :-) >> >> IMHO: yes. > > Maybe make the old one deprecated in fixes, while adding the new. Done to fixes. (which will be branched for 2.6.2)

As nobody else did it, I updated
http://wiki.freepascal.org/User_Changes_Trunk#FPCanvas_Strikethough_property_spelling_fixed_to_StrikeThrough

Please correct/update that section as needed.

Thanks,
Reinier

Reply by email

Felipe Monteiro de Carvalho
to Bart
Bart wrote
It is now > 20601, but this breaks building with 2.6.2RC1...

But if we change then it won't work with RC2 when it is released =D

Felipe Monteiro de Carvalho

Reply by email

Bart
to Mattias Gaertner
Mattias Gaertner wrote 7 lines
On Sat, 19 Jan 2013 16:30:50 +0100 Felipe Monteiro de Carvalho wrote: > On Sat, Jan 19, 2013 at 4:16 PM, Bart wrote: > > It is now > 20601, but this breaks building with 2.6.2RC1... > > But if we change then it won't work with RC2 when it is released =D

That's why I proposed to change it to something like this:

  {$IF (FPC_FULLVERSION<20600) or defined(lazcanvas_typo)} //changed
in 2.6.2 and 2.7; remove when FPC 2.6.2+ only is supported
  Font.StrikeTrough := AFont.StrikeTrough; //old version with typo
  {$ELSE}
  Font.StrikeThrough := AFont.StrikeThrough;
  {$ENDIF}

It'll build with 2.6.2RC1 with -dlazcanvas_typo and with final 2.6.2 without the define.

It will work. The old still exists, it is only marked deprecated.

Not in current Lazarus trunk (r39890) ...

Bart

Reply by email

Felipe Monteiro de Carvalho
to Mattias Gaertner: On Sat, 19 Jan 2013 16:30:50 +0100 It will work. The old still exists, it is only marked…
Mattias Gaertner wrote
It will work. The old still exists, it is only marked deprecated.

In trunk at least the old no longer exists:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-image/src/fpcanvas.pp?r1=23411&r2=23410&pathrev=23411

I haven't found the commit which merges it to 2.6.x

Felipe Monteiro de Carvalho

Reply by email

Mattias Gaertner
to Felipe Monteiro de Carvalho
Show quoted text 9 lines
On Sat, Jan 19, 2013 at 5:57 PM, Mattias Gaertner wrote: > It will work. The old still exists, it is only marked deprecated. In trunk at least the old no longer exists: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-image/src/fpcanvas.pp?r1=23411&r2=23410&pathrev=23411 I haven't found the commit which merges it to 2.6.x

It is not merged. Trunk has a replacement. The branch has an addition:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/fixes_2_6/packages/fcl-image/src/fpcanvas.pp?view=markup

We need to add the exception for 2.6.2. When the next 2.6.2RC comes out we can change it.

Mattias

Reply by email